Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

AGENTS.md

116 lines9.2 KB

AGENTS.md

Task Completion Requirements

  • Keep local verification focused on the files and packages changed. Run the smallest relevant test set; do not run the full workspace test suite as a routine completion step.
    • Use vp test run <test-files> for focused built-in Vite+ tests. Use vp run test only when the affected package specifically requires its test script.
    • Backend changes must include and run focused tests for the changed behavior.
    • Run targeted formatting, lint, and type checks for the affected scope when available.
  • Do not run repo-wide vp check, vp run typecheck, vp run test, or equivalent full-suite commands locally unless the user explicitly requests them. CI is responsible for the full verification suite.
  • After frontend feature development or any user-visible frontend behavior change, the primary agent must run one integrated verification pass for each affected client surface after integrating the work:
    • Web: use the test-t3-app skill. Launch one isolated environment, authenticate through the printed pairing URL, and verify the affected flow in the controlled browser.
    • Mobile: use the test-t3-mobile skill. Connect one representative iOS Simulator or Android Emulator available on the host to one isolated environment and verify the affected flow. On compatible macOS hosts, prefer iOS for cross-platform changes and stream it through serve-sim in the T3 Code in-app browser or another available agent browser; use Android when it is the affected or viable platform.
    • Subagents must not independently launch dev servers or repeat integrated client verification unless their delegated task explicitly requires it.
    • Stop dev servers, watchers, and other long-running verification processes when the focused verification is complete.

Package Roles

  • apps/server: Node.js WebSocket server. Wraps Codex app-server (JSON-RPC over stdio), serves the React web app, and manages provider sessions.
  • apps/web: React/Vite UI. Owns session UX, conversation/event rendering, and client-side state. Connects to the server via WebSocket.
  • packages/contracts: Shared effect/Schema schemas and TypeScript contracts for provider events, WebSocket protocol, and model/session types. Keep this package schema-only — no runtime logic.
  • packages/shared: Shared runtime utilities consumed by both server and client applications. Uses explicit subpath exports (e.g. @t3tools/shared/git) — no barrel index.
  • packages/client-runtime: Shared runtime package for sharing client code across web and mobile.

Antigravity provider

The antigravity driver wraps the Antigravity CLI (agy), which has no native agent protocol. apps/server/src/provider/acp/antigravity/agyBridge.ts presents the ACP surface AcpSessionRuntime needs and runs each turn through agy --print, shipping as hidden subcommands of the server binary (t3 agy-acp, t3 agy-hook).

A live event stream is reconstructed from two documented Antigravity sources that correlate on step index (stepIdx in a hook == step_index in the transcript):

  • Hooks (PreToolUse/PostToolUse/Stop) give tool name, arguments, and status. The bridge registers them via a throwaway --add-dir workspace so nothing is written into the user's repo. Both the session cwd and that hook workspace must be passed — --add-dir replaces the workspace rather than adding to cwd, so passing only the hook dir hides the project from the agent.
  • The trajectory transcript (transcript.jsonl) gives assistant text and real tool output as the turn runs. Its record format is undocumented, so parsing degrades to emitting nothing.

Known constraints, all inherent to print mode:

  • agy always runs with --dangerously-skip-permissions because print mode cannot prompt. Approvals instead come from the PreToolUse hook, which blocks the tool until T3 Code answers — a deny decision genuinely stops it and is reported back to the model. Controlled by the requireToolApproval setting, on by default; it fails closed on timeout, a lost bridge, or any hook failure. Turn it off to let tools run unattended.
  • What the approval gate does and does not defend against. Decisions travel as files in a per-turn temp directory, signed with an HMAC over the hook, the verdict, and a digest of the hook's own payload; the key is generated per turn and reaches the hook through the environment agy passes down. That stops an unrelated process forging a decision, stops a decision being replayed onto a different request, and stops a tool approved in one turn signing for any later turn. It does not contain a tool within the turn that approved it: that tool inherits the same environment, so it can sign decisions for other tools in that turn. Closing that needs an OS-level boundary — a broker socket or sandbox whose credentials are not inheritable — which is outside what this provider can do while agy runs unsandboxed. The gate's purpose is to stop the model acting unilaterally, not to contain code the user has already approved.
  • Attachments are passed by path, not inline: the adapter sends resource_link blocks for files the attachment store already wrote to disk, and the bridge names those paths in the prompt and adds their directory to the workspace. agy has no attachment flag, so inline image capability stays off.
  • No session modes, and no provider-side rollback — a resumed conversation keeps its full trajectory, so rollbackThread fails rather than silently truncating local state only.
  • --model is a per-spawn flag that composes with --conversation, so a model switch keeps the trajectory and applies from the next turn (sessionModelSwitch: "in-session").
  • Cancelling a turn kills agy's whole process group, not just agy: tools it started otherwise keep writing to the workspace after Stop. Every signal is guarded on the leader still being alive, because a group id belongs to us only while it holds one — once the leader is reaped the number is free, and a signal sent afterwards can land on whatever inherited it. Nothing signals a group after its exit. The cost is that a tool which deliberately outlives agy is not reaped. That is the same boundary the approval gate draws: code the user has already approved can do as it likes, including backgrounding itself. Reaping those would need a supervisor process that stays in the group, or a Windows Job Object — neither reachable in plain Node. The bridge also kills its child group on SIGTERM, SIGINT and normal exit, but a SIGKILL of the bridge itself runs no handler, and agy is then reparented to init. POSIX offers no portable parent-death signal (PR_SET_PDEATHSIG is Linux-only and not exposed by Node), so a force-killed bridge can leave one agy behind until its --print-timeout elapses.
  • Any agy subcommand spawned for a probe must set stdin: "ignore". agy starts a language server and will not emit output while stdin stays open, so the default "pipe" hangs it.
  • Runtime events are buffered without a cap, so a subscriber that stops consuming grows memory until it resumes. This is the shape every adapter uses — Claude, Codex, Cursor, Grok and OpenCode all publish through an unbounded queue or pub/sub, as does ProviderService itself — so this provider follows it rather than diverging. Bounding it is a decision for the shared runtime, not for one provider. What the bridge does bound is its own side: writeMessage honours stdout backpressure and pauses polling while the pipe is behind, so a slow reader cannot inflate the bridge process.
  • A transcript record carrying no step_index is ordered by where it was read, inheriting the preceding entry's key. Every record observed in practice carries one. If a planner response without an index were read in the same poll as the PreToolUse hook of the step after it, the tool call would be announced first. Hooks have to be ingested before transcript records — a record has nothing to attach to otherwise — so ordering the two exactly would need a shared sequence number Antigravity does not emit.

Reference Repos

Use these as implementation references when designing protocol handling, UX flows, and operational safeguards.

Vendored Repositories

This project vendors external repositories under .repos/ as read-only reference material for coding agents.

  • Prefer examples and patterns from the vendored source code over generated guesses or web search results.
  • Do not edit files under .repos/ unless explicitly asked.
  • Do not import from .repos/; application code must continue importing from normal package dependencies.
  • Manage vendored subtrees with vpr sync:repos; use vpr sync:repos --repo <id> to sync one configured repository.
  • When updating a dependency with a configured vendored subtree, sync that subtree in the same change so .repos/ matches the installed dependency version.
  • When writing Effect code, read .repos/effect-smol/LLMS.md first and inspect .repos/effect-smol/ for examples of idiomatic usage, tests, module structure, and API design.
  • When writing relay infrastructure code with Alchemy, inspect .repos/alchemy-effect/ for examples of idiomatic usage, tests, module structure, and API design.