Review of the seeding path found five ways a seeded database could describe something the copy cannot back up: - Nothing stopped `dev:seed` from running against a live server. SQLite locking lets the seed take the write lock between the server's own writes and commit cleanly; what it cannot do is tell that server its projections and event log were replaced underneath it. Refuse instead, via a pid probe over both state directories. - A thread copied mid-turn kept `state = 'running'`. The session override did not cover it — the turn is read independently, and an unsettled one leaves the thread spinning and its timeline unfoldable forever. Settle those to "interrupted", matching what the server does when a session leaves "running". Streaming messages are finished for the same reason. - Attachment metadata was copied without the files behind it, so a seeded thread rendered an image whose request 404s. Report the referenced ids and copy the matching files alongside the rows. - Orphaned `provider_session_runtime` rows survived the seed naming threads it had just deleted, which the session reaper then tried to stop against a provider instance the worktree may not define. - `--threads` had no upper bound, so a large enough value died with "too many SQL variables" after the target was already emptied. Also corrects the projector-cursor comment: `orchestration_events.sequence` is AUTOINCREMENT, so emptying the log does not reset its high-water mark and sequence does not restart at 1. Zero remains the right cursor, for the reason now stated. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
55 lines
4.9 KiB
Markdown
55 lines
4.9 KiB
Markdown
# 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.
|
|
|
|
## Dev Servers
|
|
|
|
- In a linked git worktree, dev state defaults to that worktree's gitignored `.t3`. This deliberately outranks an ambient `T3CODE_HOME`, which could otherwise select the installed app's live `~/.t3/userdata` database. An explicit `--home-dir` still wins.
|
|
- Start the web stack with `vp run dev`. Add `--share` when someone needs to open it from another device on the tailnet.
|
|
- Use `vp run dev:pair` to issue a fresh URL for the running server without reconstructing its port or origin.
|
|
- Use `vp run dev:seed` while the server is stopped to populate an isolated database with recent projects and threads from the shared home. It refuses to run against a directory a live server is using.
|
|
- Browser dev is single-origin: Vite proxies `/api`, `/ws`, `/oauth`, and `/.well-known` to the backend. Do not set `VITE_HTTP_URL` or `VITE_WS_URL` for `dev`/`dev:web`.
|
|
- Worktree paths supply stable preferred port offsets. Read the actual server and web ports from the `[dev-runner]` line because occupied ports can still shift them.
|
|
- Before handing off a `--share` URL, open its origin in a controlled browser and confirm the app loads. A successful curl is insufficient because browsers reject some otherwise reachable ports.
|
|
|
|
## 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.
|
|
|
|
## Reference Repos
|
|
|
|
- Open-source Codex repo: https://github.com/openai/codex
|
|
|
|
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.
|