Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions apps/server/src/project/AgentSessionScanner.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -973,9 +973,46 @@ it.layer(NodeServices.layer)("AgentSessionScanner", (it) => {
}),
);

it.effect("lists only projects with conversations inside the import window", () =>
Effect.gen(function* () {
const path = yield* Path.Path;
const nowMs = Date.parse("2026-08-24T12:00:00.000Z");
yield* TestClock.setTime(nowMs);
const claudeHomePath = yield* makeTempDir("t3code-window-claude-");
const codexHomePath = yield* makeTempDir("t3code-window-codex-");
const mixedWorkspace = yield* makeTempDir("t3code-window-mixed-");
const olderWorkspace = yield* makeTempDir("t3code-window-older-");

for (const [workspace, name, ageDays] of [
[mixedWorkspace, "recent", 1],
[mixedWorkspace, "old", 31],
[olderWorkspace, "older", 45],
[olderWorkspace, "oldest", 60],
] as const) {
yield* writeTranscript({
filePath: path.join(
claudeHomePath,
"projects",
`-${path.basename(workspace)}`,
`${name}.jsonl`,
),
contents: claudeSessionLine(workspace),
mtimeMs: nowMs - ageDays * 24 * 60 * 60 * 1000,
});
}

const result = yield* runScan({ claudeHomePath, codexHomePath });

expect(result.candidates.map(({ path, threadCount }) => ({ path, threadCount }))).toEqual([
{ path: mixedWorkspace, threadCount: 1 },
]);
}),
);

it.effect("drops candidates whose directory no longer exists", () =>
Effect.gen(function* () {
const path = yield* Path.Path;
yield* TestClock.setTime(Date.parse("2026-01-02T00:00:00.000Z"));
const claudeHomePath = yield* makeTempDir("t3code-claude-home-");
const codexHomePath = yield* makeTempDir("t3code-codex-home-");

Expand All @@ -994,6 +1031,7 @@ it.layer(NodeServices.layer)("AgentSessionScanner", (it) => {
it.effect("excludes the home directory, temporary root, and T3 data directory", () =>
Effect.gen(function* () {
const path = yield* Path.Path;
yield* TestClock.setTime(Date.parse("2026-01-02T00:00:00.000Z"));
const claudeHomePath = yield* makeTempDir("t3code-claude-home-");
const codexHomePath = yield* makeTempDir("t3code-codex-home-");
const configBaseDir = yield* makeTempDir("t3code-scanner-base-");
Expand Down Expand Up @@ -1021,6 +1059,7 @@ it.layer(NodeServices.layer)("AgentSessionScanner", (it) => {
it.effect("excludes T3-managed worktree sandboxes", () =>
Effect.gen(function* () {
const path = yield* Path.Path;
yield* TestClock.setTime(Date.parse("2026-01-02T00:00:00.000Z"));
const claudeHomePath = yield* makeTempDir("t3code-claude-home-");
const codexHomePath = yield* makeTempDir("t3code-codex-home-");
const fileSystem = yield* FileSystem.FileSystem;
Expand All @@ -1042,6 +1081,7 @@ it.layer(NodeServices.layer)("AgentSessionScanner", (it) => {
it.effect("folds linked git worktrees into their checkout and reports real origins", () =>
Effect.gen(function* () {
const path = yield* Path.Path;
yield* TestClock.setTime(Date.parse("2026-01-10T00:00:00.000Z"));
const fileSystem = yield* FileSystem.FileSystem;
const claudeHomePath = yield* makeTempDir("t3code-claude-home-");
const codexHomePath = yield* makeTempDir("t3code-codex-home-");
Expand Down Expand Up @@ -1301,6 +1341,7 @@ it.layer(NodeServices.layer)("AgentSessionScanner", (it) => {
it.effect("excludes sandboxes under the configured worktrees dir without .t3 in the path", () =>
Effect.gen(function* () {
const path = yield* Path.Path;
yield* TestClock.setTime(Date.parse("2026-01-02T00:00:00.000Z"));
const claudeHomePath = yield* makeTempDir("t3code-claude-home-");
const codexHomePath = yield* makeTempDir("t3code-codex-home-");
const configBaseDir = yield* makeTempDir("t3code-scanner-base-");
Expand All @@ -1323,6 +1364,7 @@ it.layer(NodeServices.layer)("AgentSessionScanner", (it) => {
it.effect("excludes sandboxes reached through a symlink into the worktrees dir", () =>
Effect.gen(function* () {
const path = yield* Path.Path;
yield* TestClock.setTime(Date.parse("2026-01-02T00:00:00.000Z"));
const claudeHomePath = yield* makeTempDir("t3code-claude-home-");
const codexHomePath = yield* makeTempDir("t3code-codex-home-");
const configBaseDir = yield* makeTempDir("t3code-scanner-base-");
Expand All @@ -1348,6 +1390,7 @@ it.layer(NodeServices.layer)("AgentSessionScanner", (it) => {
it.effect("finds the cwd on a later line when the first records carry none", () =>
Effect.gen(function* () {
const path = yield* Path.Path;
yield* TestClock.setTime(Date.parse("2026-01-02T00:00:00.000Z"));
const claudeHomePath = yield* makeTempDir("t3code-claude-home-");
const codexHomePath = yield* makeTempDir("t3code-codex-home-");
const workspace = yield* makeTempDir("t3code-workspace-");
Expand All @@ -1368,6 +1411,7 @@ it.layer(NodeServices.layer)("AgentSessionScanner", (it) => {
it.effect("reads a complete transcript record at the exact chunk boundary", () =>
Effect.gen(function* () {
const path = yield* Path.Path;
yield* TestClock.setTime(Date.parse("2026-01-02T00:00:00.000Z"));
const claudeHomePath = yield* makeTempDir("t3code-claude-home-");
const codexHomePath = yield* makeTempDir("t3code-codex-home-");
const workspace = yield* makeTempDir("t3code-workspace-");
Expand All @@ -1392,6 +1436,7 @@ it.layer(NodeServices.layer)("AgentSessionScanner", (it) => {
it.effect("skips malformed transcripts without failing the scan", () =>
Effect.gen(function* () {
const path = yield* Path.Path;
yield* TestClock.setTime(Date.parse("2026-05-04T00:00:00.000Z"));
const claudeHomePath = yield* makeTempDir("t3code-claude-home-");
const codexHomePath = yield* makeTempDir("t3code-codex-home-");
const workspace = yield* makeTempDir("t3code-workspace-");
Expand Down Expand Up @@ -1432,6 +1477,7 @@ it.layer(NodeServices.layer)("AgentSessionScanner", (it) => {
Effect.gen(function* () {
const fileSystem = yield* FileSystem.FileSystem;
const path = yield* Path.Path;
yield* TestClock.setTime(Date.parse("2026-05-04T00:00:00.000Z"));
const claudeHomePath = yield* makeTempDir("t3code-claude-home-");
const codexHomePath = yield* makeTempDir("t3code-codex-home-");
const workspace = yield* makeTempDir("t3code-workspace-");
Expand Down Expand Up @@ -1462,6 +1508,7 @@ it.layer(NodeServices.layer)("AgentSessionScanner", (it) => {
it.effect("discovers projects whose Codex rollouts are zstd-compressed", () =>
Effect.gen(function* () {
const path = yield* Path.Path;
yield* TestClock.setTime(Date.parse("2026-05-04T00:00:00.000Z"));
const claudeHomePath = yield* makeTempDir("t3code-claude-home-");
const codexHomePath = yield* makeTempDir("t3code-codex-home-");
const workspace = yield* makeTempDir("t3code-workspace-");
Expand Down
11 changes: 10 additions & 1 deletion apps/server/src/project/AgentSessionScanner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1881,7 +1881,16 @@ export const make = Effect.gen(function* () {

const scan: AgentSessionScanner["Service"]["scan"] = Effect.gen(function* () {
cachedCandidates = yield* collectCandidates();
const { candidates: raw, truncated } = cachedCandidates;
const { candidates: collected, truncated } = cachedCandidates;
// Import skips conversations older than the window, so only those inside it count toward a
// project. Future-dated files still count, so clock skew cannot hide a project.
const cutoffMs = DateTime.toEpochMillis(yield* DateTime.now) - RECENT_THREAD_WINDOW_MS;
const raw = collected.flatMap((candidate) => {
const threadCount = candidate.transcripts.filter(
(transcript) => transcript.mtimeMs !== null && transcript.mtimeMs >= cutoffMs,
).length;
return threadCount === 0 ? [] : [{ ...candidate, threadCount }];
});

const merged = new Map<
string,
Expand Down
15 changes: 8 additions & 7 deletions docs/user/welcome-page.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,14 @@ app with a code from **Settings → Sharing & access**.

## Projects

T3 Code finds directories that Claude Code, Codex or Pi has used. Git repositories
are listed first, newest activity on top. When the remote is on GitHub, the
group shows the repository as `owner/name`. Clones with the same remote share
one group. Directories that are not git repositories sit under "Other folders".

The page offers git repositories active within the last 30 days with at least
three conversations, already checked. Projects already in T3 Code are not checked
T3 Code finds directories that Claude Code, Codex or Pi has used in the last 30
days. Git repositories are listed first, newest activity on top. When the remote
is on GitHub, the group shows the repository as `owner/name`. Clones with the
same remote share one group. Directories that are not git repositories sit under
"Other folders".

The page offers git repositories with at least three conversations in that time,
already checked. Projects already in T3 Code are not checked
again. Uncheck the box to start without them, or
select **Review all** to pick from everything found, with "Select all" and
"Select none". Linked worktrees of bare repositories
Expand Down
Loading