Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
96 commits
Select commit Hold shift + click to select a range
a4f6403
port(memory): docs/architecture/LOCAL_MACOS_AGENT_HARNESS.md
jameswright1562 Nov 10, 2026
3885e5e
port(memory): apps/server/src/memory/AgentMemory.ts
jameswright1562 Nov 10, 2026
4b1726e
port(memory): apps/server/src/memory/MemoryContext.ts
jameswright1562 Nov 10, 2026
0fc79ba
port(memory): apps/server/src/memory/AgentMemory.test.ts
jameswright1562 Nov 10, 2026
0148974
port(memory): apps/server/src/memory/MemoryContext.test.ts
jameswright1562 Nov 10, 2026
160b457
feat(memory): add migration 081 on current upstream schema
jameswright1562 Nov 10, 2026
db149a9
feat(memory): register migration 81 in upstream v2 runtime
jameswright1562 Nov 10, 2026
86cd539
port(opencode): checkout launch and config helpers to upstream provid…
jameswright1562 Nov 10, 2026
9e2661e
port(opencode): checkout launch and config helpers to upstream provid…
jameswright1562 Nov 10, 2026
9022ec5
feat(opencode): expose custom JSONC provider config in T3 settings UI
jameswright1562 Nov 10, 2026
4130308
feat(opencode): inject UI JSONC into native OpenCode runtime environment
jameswright1562 Nov 10, 2026
b907221
feat(opencode): support source checkout launches without misidentifyi…
jameswright1562 Nov 10, 2026
1805870
feat(memory): provide scoped, token-bounded project memory to agent s…
jameswright1562 Nov 10, 2026
ff0fda1
feat(memory): inject source-backed project context only on fresh prov…
jameswright1562 Nov 10, 2026
ea90d33
feat(memory): register project-memory context service with provider-t…
jameswright1562 Nov 10, 2026
f1b15ac
feat(memory): save task context checkpoints after durable T3 run fina…
jameswright1562 Nov 10, 2026
9e6cd0b
ci: run focused memory/OpenCode tests and affected typechecks on fork
jameswright1562 Nov 10, 2026
18f68f9
fix(opencode): inspect script shebang without loading native executab…
jameswright1562 Nov 10, 2026
4261aa6
fix(memory): use typed Effect errors, clock and JSON codecs; reusable…
jameswright1562 Nov 10, 2026
071a924
fix(memory): encode snapshot using Effect JSON codec and trace safe c…
jameswright1562 Nov 10, 2026
f74a9cd
test(memory): use repository-supported Effect test runner
jameswright1562 Nov 10, 2026
79317c8
fix(memory): yield typed Effect errors directly
jameswright1562 Nov 10, 2026
c8f8e63
feat(memory): declare agent memory search and proposal MCP tools
jameswright1562 Nov 10, 2026
731dd13
feat(memory): implement scoped agent memory proposal and retrieval ha…
jameswright1562 Nov 10, 2026
bdea38b
fix(memory): use real template interpolation for durable memory IDs a…
jameswright1562 Nov 10, 2026
677b031
feat(memory): register scoped agent memory MCP tools in T3 server
jameswright1562 Nov 10, 2026
30db37b
feat(memory): add privileged user-confirmation transition for propose…
jameswright1562 Nov 10, 2026
ef324ef
test(memory): confirm proposed memories idempotently before context c…
jameswright1562 Nov 10, 2026
e4841dd
fix(memory): invoke scoped MCP caller Effect service before reading t…
jameswright1562 Nov 10, 2026
b887870
docs: explain current upstream integration, actual memory capabilitie…
jameswright1562 Nov 10, 2026
aa0c890
docs: link live macOS memory implementation and honest feature status…
jameswright1562 Nov 10, 2026
362eff9
ci: validate MCP toolkit regressions and separate provider/server typ…
jameswright1562 Nov 10, 2026
9d0480b
fix(opencode): use workspace test runner and document necessary sync …
jameswright1562 Nov 10, 2026
81a941a
fix(opencode): use workspace test runner and document necessary sync …
jameswright1562 Nov 10, 2026
a80c276
docs(memory): distinguish checkpoint run ordinals from authoritative …
jameswright1562 Nov 10, 2026
70aa12c
docs(memory): distinguish checkpoint run ordinals from authoritative …
jameswright1562 Nov 10, 2026
24c1c69
docs(memory): distinguish checkpoint run ordinals from authoritative …
jameswright1562 Nov 10, 2026
8464130
fix(memory): recover last valid scoped checkpoint and expose bounded …
jameswright1562 Nov 10, 2026
371e83e
test(memory): corrupted-checkpoint fallback and cross-project export …
jameswright1562 Nov 10, 2026
2f84bd1
docs: consolidate all outstanding release gaps and security/recovery …
jameswright1562 Nov 10, 2026
06983ee
fix(memory): use Effect.result for corrupt snapshot recovery
jameswright1562 Nov 10, 2026
480b191
fix(memory): parse and validate checkpoints directly before recovery
jameswright1562 Nov 10, 2026
a56a31b
feat(harness): define typed permission-scoped memory RPC contracts
jameswright1562 Nov 10, 2026
29822c0
feat(harness): add scoped memory and recovery RPC methods
jameswright1562 Nov 10, 2026
2526be4
feat(harness): export memory contracts
jameswright1562 Nov 10, 2026
3c8d3c7
feat(memory): auditable idempotent pin mutations
jameswright1562 Nov 10, 2026
b662458
fix(auth): restrict memory approvals and mutations to settings-write …
jameswright1562 Nov 10, 2026
b3ffad3
fix(auth): restrict memory approvals and mutations to settings-write …
jameswright1562 Nov 10, 2026
9e5aa84
feat(harness): expose host-authorized memory and checkpoint RPC handlers
jameswright1562 Nov 10, 2026
a28c637
feat(harness): connect memory RPCs to reactive client runtime
jameswright1562 Nov 10, 2026
1b562ce
feat(ui): review, approve, pin, forget and export scoped agent memories
jameswright1562 Nov 10, 2026
2987ca1
feat(ui): surface project memory management in Settings
jameswright1562 Nov 10, 2026
0f4703b
fix(memory): parse checkpoint via typed Effect JSON codec
jameswright1562 Nov 10, 2026
eaf5e6e
fix(harness): classify new RPCs in exhaustive telemetry map
jameswright1562 Nov 10, 2026
5334dee
ci: validate memory RPC contracts, client runtime and web UI
jameswright1562 Nov 10, 2026
249acaf
merge(main): reconcile May fork with upstream-based harness branch
jameswright1562 Nov 10, 2026
c28070c
fix(client): use permission-aware query for guarded memory RPCs
jameswright1562 Nov 10, 2026
2471462
test(memory): audit pin toggles and enforce project isolation
jameswright1562 Nov 10, 2026
b664bf1
security(harness): require settings-write privilege even for private …
jameswright1562 Nov 10, 2026
31b782b
security(harness): require settings-write privilege even for private …
jameswright1562 Nov 10, 2026
49723fb
fix(orchestration): make memory context optional for isolated provide…
jameswright1562 Nov 10, 2026
463ca72
fix(orchestration): preserve isolated tests while checkpointing when …
jameswright1562 Nov 10, 2026
8d9a213
feat(mcp): persist shared HTTP and stdio MCP metadata without credent…
jameswright1562 Nov 10, 2026
88cdb50
feat(mcp): merge per-server upserts/deletes atomically with existing …
jameswright1562 Nov 10, 2026
910e586
feat(mcp): select and safely map scoped shared servers for native age…
jameswright1562 Nov 10, 2026
8317fe8
test(mcp): scope isolation, unsafe URL rejection and provider seriali…
jameswright1562 Nov 10, 2026
eed4748
fix(mcp): send mutable argv arrays to native SDK connectors
jameswright1562 Nov 10, 2026
2b518d4
feat(mcp): load project-scoped shared MCP servers into Claude native …
jameswright1562 Nov 10, 2026
5f8e84e
feat(mcp): bind native session metadata to canonical project scope
jameswright1562 Nov 10, 2026
de565a0
feat(mcp): scope issued provider MCP session to canonical calling pro…
jameswright1562 Nov 10, 2026
7954182
feat(mcp): attach canonical per-project MCP settings to Codex native …
jameswright1562 Nov 10, 2026
6b5b0dd
feat(mcp): preserve scoped external MCP routing on Codex resume, fork…
jameswright1562 Nov 10, 2026
d710855
build(shared): expose typed harness MCP router to native provider ada…
jameswright1562 Nov 10, 2026
5c65cb2
feat(ui): manage shared stdio/HTTP MCP servers and provider/project r…
jameswright1562 Nov 10, 2026
63832a3
feat(ui): expose custom MCP server manager in General Settings
jameswright1562 Nov 10, 2026
177c925
security(mcp): fail closed when native runtime cannot enforce configu…
jameswright1562 Nov 10, 2026
d2773cb
ci: exercise MCP registry tests, web build and shared provider contra…
jameswright1562 Nov 10, 2026
c639a27
feat(mcp): carry host-selected external server registry in native ses…
jameswright1562 Nov 10, 2026
66d71cc
feat(mcp): centrally authorize custom servers when issuing native age…
jameswright1562 Nov 10, 2026
c66f6a0
test(mcp): assert beta project receives only its explicitly scoped se…
jameswright1562 Nov 10, 2026
fd1175d
merge(main): align orchestration PR with synced upstream and fork Ope…
jameswright1562 Nov 10, 2026
c54586e
fix(ci): use workspace @effect/vitest for shared MCP tests
jameswright1562 Nov 10, 2026
0dd8451
feat(memory): transactional user revisions with source trace and immu…
jameswright1562 Nov 10, 2026
21c3563
feat(memory): add typed revision operation to RPC contracts
jameswright1562 Nov 10, 2026
b2e8217
feat(memory): add typed revision operation to RPC contracts
jameswright1562 Nov 10, 2026
7fa513e
feat(memory): authorize and route append-only revisions through host UI
jameswright1562 Nov 10, 2026
59807f3
feat(memory): authorize and route append-only revisions through host UI
jameswright1562 Nov 10, 2026
8e0f0a9
feat(memory): authorize and route append-only revisions through host UI
jameswright1562 Nov 10, 2026
a86932f
feat(memory): authorize and route append-only revisions through host UI
jameswright1562 Nov 10, 2026
ab5e0c3
feat(memory): authorize and route append-only revisions through host UI
jameswright1562 Nov 10, 2026
7562394
feat(ui): edit memory with explicit verified revision and immutable s…
jameswright1562 Nov 10, 2026
eab1bd7
test(memory): verify append-only revisions, provenance, idempotent re…
jameswright1562 Nov 10, 2026
53bcc6a
ci(types): exclude non-blocking Effect suggestions while retaining er…
jameswright1562 Nov 10, 2026
b375b01
feat(cursor): attach host-authorized shared stdio/HTTP MCP servers to…
jameswright1562 Nov 10, 2026
8f595e8
fix(test): provide inert SqlClient for MCP registration budget tests
jameswright1562 Nov 10, 2026
470ecf5
fix(test): provide real in-memory SQLite to MCP tool registration tests
jameswright1562 Nov 10, 2026
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
77 changes: 77 additions & 0 deletions .github/workflows/fork-memory-checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Fork memory and OpenCode validation

on:
pull_request:
paths:
- "apps/server/src/memory/**"
- "apps/server/src/persistence/**"
- "apps/server/src/orchestration-v2/ProviderTurnStartService.ts"
- "apps/server/src/orchestration-v2/RunFinalizationService.ts"
- "apps/server/src/orchestration-v2/runtimeLayer.ts"
- "packages/provider-opencode/**"
- "packages/contracts/src/harnessMemory.ts"
- "packages/contracts/src/rpc.ts"
- "packages/contracts/src/index.ts"
- "packages/contracts/src/clientRpcPermissions.ts"
- "packages/client-runtime/src/state/server.ts"
- "apps/server/src/ws.ts"
- "apps/server/src/auth/RpcAuthorization.ts"
- "apps/server/src/observability/RpcInstrumentation.ts"
- "apps/web/src/components/settings/AgentMemorySettings.tsx"
- "apps/web/src/components/settings/SettingsPanels.tsx"
- "apps/web/src/components/settings/HarnessMcpSettings.tsx"
- "packages/shared/src/harnessMcp.ts"
- "packages/shared/src/harnessMcp.test.ts"
- "packages/shared/src/serverSettings.ts"
- "packages/shared/package.json"
- "packages/contracts/src/settings.ts"
- "packages/provider-core/src/server/mcpSession.ts"
- "apps/server/src/orchestration-v2/ProviderSessionManager.ts"
- "apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts"
- "apps/server/src/orchestration-v2/Adapters/CodexAdapterV2.ts"
- ".github/workflows/fork-memory-checks.yml"
push:
branches:
- "feat/macos-orchestrator-upstream-base"
workflow_dispatch:

permissions:
contents: read

jobs:
focused:
name: Memory/OpenCode tests and typecheck
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: |
/*
!/.repos/
sparse-checkout-cone-mode: false
- name: Setup workspace
uses: ./.github/actions/setup-ci-deps
with:
save-pnpm-store: "false"
- name: Run memory and launch tests
run: |
vp test run \
apps/server/src/memory/AgentMemory.test.ts \
apps/server/src/memory/MemoryContext.test.ts \
packages/provider-opencode/src/server/openCodeLaunch.test.ts \
apps/server/src/mcp/toolkits/core.test.ts \
packages/shared/src/harnessMcp.test.ts \
packages/contracts/src/settings.test.ts
- name: Typecheck OpenCode provider
run: vp run --filter @t3tools/provider-opencode typecheck
- name: Typecheck contracts and client runtime
run: |
vp run --filter @t3tools/contracts typecheck
vp run --filter @t3tools/client-runtime typecheck
- name: Build web UI
run: vp run --filter @t3tools/web build
- name: Typecheck shared MCP contracts
run: vp run --filter @t3tools/shared typecheck
- name: Typecheck server
run: vp run --filter t3 typecheck
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# T3 Code

> **Fork work in progress:** This branch adds persistent source-backed memory, context checkpoints, OpenCode custom configuration and a local macOS orchestration plan. See the [architecture and implementation status](./docs/architecture/LOCAL_MACOS_AGENT_HARNESS.md) and [draft PR #3](https://github.com/jameswright1562/t3code/pull/3). The Memory UI and custom HTTP/stdio MCP server manager are not implemented yet; do not treat this branch as a stable release.


T3 Code is an "agent harness control surface". It enables control of the agents on your machine with a best-in-class mobile app ([iOS](https://apps.apple.com/us/app/t3-code-remote-claude-more/id6787819824), [Android](https://play.google.com/store/apps/details?id=com.t3tools.t3code)), [web app](https://app.t3.codes) and [Electron-based desktop app](https://t3.codes).

Works with your subscriptions on Claude Code, Codex, Cursor, Grok Build, OpenCode, Google Antigravity, and fx. If they're set up on your computer, T3 Code can control them.
Expand Down
7 changes: 7 additions & 0 deletions apps/server/src/auth/RpcAuthorization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,13 @@ export const RPC_REQUIRED_SCOPES = {
[ORCHESTRATION_V2_WS_METHODS.subscribePromptSuggestion]: AuthOrchestrationReadScope,
[WS_METHODS.projectsMutate]: AuthOrchestrationOperateScope,
[WS_METHODS.serverProbe]: AuthOrchestrationReadScope,
[WS_METHODS.harnessMemoryList]: AuthSettingsWriteScope,
[WS_METHODS.harnessMemoryExport]: AuthSettingsWriteScope,
[WS_METHODS.harnessCheckpointRecover]: AuthSettingsWriteScope,
[WS_METHODS.harnessMemoryConfirm]: AuthSettingsWriteScope,
[WS_METHODS.harnessMemoryForget]: AuthSettingsWriteScope,
[WS_METHODS.harnessMemoryPin]: AuthSettingsWriteScope,
[WS_METHODS.harnessMemoryRevise]: AuthSettingsWriteScope,
[WS_METHODS.serverGetConfig]: AuthOrchestrationReadScope,
[WS_METHODS.serverGetNpmRelease]: AuthOrchestrationReadScope,
[WS_METHODS.serverRefreshProviders]: AuthOrchestrationReadScope,
Expand Down
5 changes: 5 additions & 0 deletions apps/server/src/mcp/McpHttpServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ import { PreviewControlsToolkit } from "./toolkits/previewControls/tools.ts";
import * as PreviewControlsHandlers from "./toolkits/previewControls/handlers.ts";
import { EnvironmentToolkit } from "./toolkits/environment/tools.ts";
import * as EnvironmentHandlers from "./toolkits/environment/handlers.ts";
import { MemoryToolkit } from "./toolkits/memory/tools.ts";
import * as MemoryHandlers from "./toolkits/memory/handlers.ts";
import { ProjectToolkit } from "./toolkits/project/tools.ts";
import * as ProjectHandlers from "./toolkits/project/handlers.ts";
import { AttachmentToolkit } from "./toolkits/attachment/tools.ts";
Expand Down Expand Up @@ -1165,6 +1167,8 @@ export const layerOrchestratorToolkit = toolkitRegistration(

export const layerThreadToolkit = toolkitRegistration(ThreadToolkit, ThreadHandlers.layer);

export const layerMemoryToolkit = toolkitRegistration(MemoryToolkit, MemoryHandlers.layer);

const layerWorktreeToolkitRegistration = toolkitRegistration(
WorktreeToolkit,
WorktreeHandlers.layer,
Expand Down Expand Up @@ -1241,6 +1245,7 @@ export const layerTools = Layer.mergeAll(
layerPreviewToolkit,
layerOrchestratorToolkit,
layerThreadToolkit,
layerMemoryToolkit,
layerAttachmentToolkit,
layerProjectRegistration,
layerEnvironmentToolkit,
Expand Down
80 changes: 80 additions & 0 deletions apps/server/src/mcp/toolkits/memory/handlers.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
import { OrchestratorMcpFailure } from "@t3tools/contracts";
import * as Effect from "effect/Effect";

import { listMemory, remember } from "../../../memory/AgentMemory.ts";
import { selectMemoryForContext } from "../../../memory/MemoryContext.ts";
import * as McpToolAccess from "../../McpToolAccess.ts";
import { newCommandId, readCaller, unavailable } from "../../threadAccess.ts";
import { MemoryToolkit } from "./tools.ts";

/** The canonical T3 thread belongs to exactly one project. Never accept a
* project ID from the agent or from text returned by a tool. */
const callerContext = Effect.fn("mcp.memory.caller")(function* () {
const context = yield* readCaller();
if (context.caller === undefined || context.scope.thread === undefined) {
return yield* new OrchestratorMcpFailure({
code: "capability_denied",
message: "Project memory requires a live thread caller.",
});
}
return {
projectId: context.caller.projectId,
threadId: context.caller.id,
sessionId: context.scope.thread.providerSessionId,
providerInstanceId: context.scope.thread.providerInstanceId,
};
});

export const layer = McpToolAccess.toLayer(MemoryToolkit, {
t3_memory_search: McpToolAccess.readsAsCaller(({ query, maxItems }) =>
Effect.gen(function* () {
const caller = yield* callerContext();
const scopes = [
{ scopeType: "project" as const, scopeId: caller.projectId },
{ scopeType: "thread" as const, scopeId: caller.threadId },
];
const stored = yield* listMemory(scopes, 100).pipe(Effect.mapError(unavailable));
const selected = selectMemoryForContext(stored, {
query,
allowedScopes: scopes,
maxEstimatedTokens: 900,
maxEntries: maxItems ?? 12,
});
return {
entries: selected.memories.map((entry) => ({
id: entry.id,
scope: entry.scopeType === "thread" ? "thread" as const : "project" as const,
kind: entry.kind,
content: entry.content,
sourceRef: entry.sourceRef,
verification: entry.verification,
})),
estimatedTokens: selected.estimatedTokens,
};
}),
),
t3_memory_propose: McpToolAccess.actsAsCaller(({ scope, kind, content }) =>
Effect.gen(function* () {
const caller = yield* callerContext();
if (!content.trim()) {
return yield* new OrchestratorMcpFailure({
code: "invalid_request",
message: "Memory content must be nonempty.",
});
}
const id = yield* newCommandId();
const saved = yield* remember({
id: `mcp:memory:${id}`,
eventId: `mcp:memory:created:${id}`,
scopeType: scope,
scopeId: scope === "project" ? caller.projectId : caller.threadId,
kind,
content,
sourceRef: `thread:${caller.threadId}:session:${caller.sessionId}`,
sourceActor: `agent:${caller.providerInstanceId}`,
verification: "proposed",
}).pipe(Effect.mapError(unavailable));
return { id: saved.id, verification: "proposed" as const };
}),
),
});
70 changes: 70 additions & 0 deletions apps/server/src/mcp/toolkits/memory/tools.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import { OrchestratorMcpFailure } from "@t3tools/contracts";
import * as SecureRandom from "effect/crypto/SecureRandom";
import * as Schema from "effect/Schema";
import * as SqlClient from "effect/sql/SqlClient";
import { Tool, Toolkit } from "effect/ai";

import * as ThreadManagement from "../../../orchestration-v2/ThreadManagementService.ts";
import * as McpInvocationContext from "../../McpInvocationContext.ts";

const MemoryKind = Schema.Literals([
"fact",
"decision",
"preference",
"constraint",
"file_reference",
"failed_approach",
"open_question",
"procedure",
"outcome",
]);

const dependencies = [
McpInvocationContext.McpInvocationContext,
ThreadManagement.ThreadManagementService,
SecureRandom.SecureRandom,
SqlClient.SqlClient,
];

const MemoryEntry = Schema.Struct({
id: Schema.String,
scope: Schema.Literals(["project", "thread"]),
kind: MemoryKind,
content: Schema.String,
sourceRef: Schema.String,
verification: Schema.Literals(["proposed", "verified", "user_confirmed"]),
});

const Search = Tool.make("t3_memory_search", {
description:
"Find source-backed notes in this thread and project. Results exclude unreviewed proposals and are bounded to avoid context growth.",
parameters: Schema.Struct({
query: Schema.String.check(Schema.isMaxLength(1000)),
maxItems: Schema.optional(Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: 25 }))),
}),
success: Schema.Struct({
entries: Schema.Array(MemoryEntry),
estimatedTokens: Schema.Number,
}),
failure: OrchestratorMcpFailure,
failureMode: "return" as const,
dependencies,
})
.annotate(Tool.Readonly, true)
.annotate(Tool.Destructive, false);

const Propose = Tool.make("t3_memory_propose", {
description:
"Propose saving a useful fact, decision or instruction for this thread or project. Agent proposals are NOT trusted or injected as memory until a user verifies them. Never save secrets.",
parameters: Schema.Struct({
scope: Schema.Literals(["project", "thread"]),
kind: MemoryKind,
content: Schema.String.check(Schema.isMaxLength(4000)),
}),
success: Schema.Struct({ id: Schema.String, verification: Schema.Literal("proposed") }),
failure: OrchestratorMcpFailure,
failureMode: "return" as const,
dependencies,
}).annotate(Tool.Destructive, true);

export const MemoryToolkit = Toolkit.make(Search, Propose);
Loading
Loading