Skip to content

Commit 31d87ab

Browse files
authored
[codex] restructure repository documentation (#41)
1 parent 546cf9a commit 31d87ab

12 files changed

Lines changed: 589 additions & 265 deletions

File tree

README.md

Lines changed: 120 additions & 245 deletions
Large diffs are not rendered by default.

ROADMAP.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# agent-tty roadmap
22

3-
`RELEASE.md` defines what `0.1.0` ships today. This roadmap tracks intentionally deferred work and post-release direction so the repository front door separates shipped scope from future scope.
3+
`RELEASE.md` defines what the current `0.1.x` line supports. This roadmap tracks intentionally deferred work and post-release direction so the repository front door separates shipped scope from future scope.
44
For historical week-by-week planning and status context, see [`design/archive/`](./design/archive/). For the stable design overview, see [`design/ARCHITECTURE.md`](./design/ARCHITECTURE.md).
55

66
## Near-term refinements

design/ARCHITECTURE.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ It is designed to let an agent:
1919

2020
This design intentionally describes a **general product**, not a Mux-specific implementation. A future Mux integration should consume `agent-tty` as an external CLI/runtime rather than baking Mux-specific assumptions into the design.
2121

22-
## Current shipped status (2026-03-26)
22+
## Current shipped status
2323

24-
Update (2026-03-26): Week 9 is now complete as the pre-`0.1.0` release-readiness milestone. The shipped surface now includes the new `run` command for robust in-session command execution, renderer/browser-path handling that respects isolated-home workflows, and isolation-aware `doctor --json` diagnostics on top of the earlier lifecycle, snapshot, screenshot, and export work. With the explicit release contract captured in [`../RELEASE.md`](../RELEASE.md), the repository is ready for `0.1.0` once maintainers are satisfied with the documented proof bundles and release checklist; larger asks such as native renderers, mouse input, remote/network sessions, MCP wrapping, and broader semantic TUI automation remain intentionally deferred.
24+
The current `0.1.x` line is centered on reliable, isolated, reviewable terminal and TUI automation. The shipped surface includes `run` for robust in-session command execution, renderer/browser-path handling that respects isolated-home workflows, and isolation-aware `doctor --json` diagnostics on top of lifecycle, snapshot, screenshot, and export work. Larger asks such as native renderers, mouse input, remote/network sessions, MCP wrapping, and broader semantic TUI automation remain intentionally deferred and tracked in [`../ROADMAP.md`](../ROADMAP.md).
2525

2626
The repository now ships the first three milestones of this design plus Weeks 4–7 of CLI/artifact/lifecycle hardening, config/rendering/platform closeout, contract/introspection reconciliation, and Week 7 contract/doc ratification:
2727

@@ -68,6 +68,8 @@ This shape optimizes for the constraints discussed so far:
6868
- it avoids committing v1 to one terminal emulator forever,
6969
- and it preserves a clean path to a later Rust rewrite of hot paths.
7070

71+
The product is inspired by `agent-browser`'s stateful, inspectable automation model, applied to terminal sessions instead of browser pages.
72+
7173
## Primary goals
7274

7375
### Product goals
@@ -191,9 +193,8 @@ V1 is successful when an AI agent can:
191193
5. fetch a semantic snapshot of the screen,
192194
6. capture a PNG screenshot,
193195
7. destroy the session,
194-
8. and leave behind an artifact bundle that a human reviewer can inspect.
195-
196-
Asciicast and replay-video export remain intended follow-on capabilities rather than current success criteria for the shipped slice.
196+
8. export asciicast or WebM replay artifacts,
197+
9. and leave behind an artifact bundle that a human reviewer can inspect.
197198

198199
## Deliverables in this design set
199200

docs/AGENT-SKILLS.md

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# Agent Skills
2+
3+
`agent-tty` ships two related skill trees in the npm package and GitHub Release tarball:
4+
5+
- `skills/agent-tty/` is the thin public bootstrap used by TanStack Intent and other skill loaders that discover files directly.
6+
- `skill-data/` contains canonical runtime skills served by the CLI.
7+
- `agent-tty skills list` discovers the bundled runtime skills, including `agent-tty` and `dogfood-tui`.
8+
9+
Install `agent-tty` first, then either copy the bootstrap skill into your agent config or let the CLI print the canonical runtime skill on demand.
10+
11+
For coding agents that can ingest instructions on demand:
12+
13+
```bash
14+
agent-tty skills get agent-tty
15+
agent-tty skills list
16+
agent-tty skills get dogfood-tui
17+
```
18+
19+
`dogfood-tui` is the built-in TUI dogfooding skill for exploratory testing, bug hunting, release-readiness validation, and UX review of terminal applications.
20+
21+
## TanStack Intent
22+
23+
After installing `agent-tty` in the project, let Intent wire the bootstrap from `skills/agent-tty/` into `AGENTS.md`, `CLAUDE.md`, or another supported agent config file.
24+
25+
```bash
26+
PACKAGE_VERSION=<version>
27+
npm install "agent-tty@${PACKAGE_VERSION}"
28+
npx @tanstack/intent@latest list
29+
npx @tanstack/intent@latest install
30+
```
31+
32+
That workflow keeps the skill version aligned with the installed `agent-tty` package, while the bootstrap stays small and points agents back to the CLI-served runtime skill.
33+
34+
## Mux
35+
36+
After installing the npm package globally, copy the bootstrap skill from `skills/agent-tty/`:
37+
38+
```bash
39+
mkdir -p ~/.mux/skills/agent-tty
40+
cp -R "$(npm root -g)/agent-tty/skills/agent-tty/." ~/.mux/skills/agent-tty/
41+
```
42+
43+
Mux can then discover the bootstrap normally, and the bootstrap instructs the agent to load the canonical runtime skill with `agent-tty skills get agent-tty`.
44+
45+
## Direct Skill Copy
46+
47+
For loaders that read skill files directly:
48+
49+
```bash
50+
mkdir -p ~/.claude/skills/agent-tty
51+
cp -R "$(npm root -g)/agent-tty/skills/agent-tty/." ~/.claude/skills/agent-tty/
52+
```
53+
54+
If your assistant supports repository-backed skills, point it at `coder/agent-tty` and select the `skills/agent-tty/` bootstrap directory.
55+
56+
## Suggested Agent Config Snippet
57+
58+
```markdown
59+
## Terminal Automation
60+
61+
Use `agent-tty` for terminal and TUI automation instead of `tmux`, ad hoc PTY wrappers, or external screenshot tools.
62+
63+
Preferred workflow:
64+
65+
1. Create an isolated home and session with `agent-tty --home "$AGENT_HOME" create --json -- /bin/bash`.
66+
2. Use `agent-tty run` for setup and bootstrap commands.
67+
3. Use `agent-tty wait` for observable readiness instead of blind sleeps.
68+
4. Use `agent-tty snapshot` to inspect the current terminal state.
69+
5. Use `agent-tty screenshot` or `agent-tty record export` for reviewer-facing artifacts.
70+
6. Destroy the session when the task is done.
71+
```
72+
73+
Maintainers can validate the shipped bootstrap skill locally with:
74+
75+
```bash
76+
npm run intent:validate
77+
```
78+
79+
## Public Example Rule
80+
81+
Keep public skill and public-facing skill docs binary-first.
82+
Use `agent-tty ...` in committed examples, not repo-local `npx`, `tsx`, or `src/cli/main.ts` invocations.
83+
When executing those examples from a source checkout, translate them locally.

docs/CONTRIBUTING.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ npm run intent:validate
5050
## Documentation and proof expectations
5151

5252
- Keep the root docs split clear: `README.md` for overview, `RELEASE.md` for supported scope, `ROADMAP.md` for future scope.
53+
- Put detailed user-facing instructions in focused docs under `docs/`: `INSTALL.md`, `USAGE.md`, `AGENT-SKILLS.md`, and `TROUBLESHOOTING.md`.
5354
- Update [`design/README.md`](../design/README.md) when the active vs archived design split changes.
5455
- Keep the skill split clear in docs and packaging notes: `skills/` contains the thin public bootstrap, while `skill-data/` contains the canonical runtime skills served by `agent-tty skills get`.
5556
- Update [`dogfood/CATALOG.md`](../dogfood/CATALOG.md) when you add or promote a reviewer-facing proof bundle.

docs/INSTALL.md

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
# Installation
2+
3+
`agent-tty` requires Node `>=24 <26`.
4+
The recommended install path is the npm package `agent-tty`.
5+
GitHub Release tarballs are the registry-independent fallback, and direct git dependency installs remain best-effort because they build from source.
6+
7+
After any install, verify the binary and local environment:
8+
9+
```bash
10+
agent-tty version --json
11+
agent-tty --home "$(mktemp -d)" doctor --json
12+
```
13+
14+
If `doctor --json` reports a missing Playwright browser cache on a fresh machine, run:
15+
16+
```bash
17+
npx playwright install chromium
18+
```
19+
20+
## npm
21+
22+
### Global install
23+
24+
```bash
25+
npm install -g agent-tty
26+
agent-tty version --json
27+
agent-tty --home "$(mktemp -d)" doctor --json
28+
```
29+
30+
For automation, pin an exact version:
31+
32+
```bash
33+
PACKAGE_VERSION=<version>
34+
npm install -g "agent-tty@${PACKAGE_VERSION}"
35+
agent-tty version --json
36+
```
37+
38+
To follow a prerelease channel, use a dist-tag such as `@beta` or `@rc`:
39+
40+
```bash
41+
npm install -g agent-tty@beta
42+
```
43+
44+
### Project-local install
45+
46+
```bash
47+
npm install agent-tty
48+
./node_modules/.bin/agent-tty version --json
49+
```
50+
51+
With an exact version:
52+
53+
```bash
54+
PACKAGE_VERSION=<version>
55+
npm install "agent-tty@${PACKAGE_VERSION}"
56+
./node_modules/.bin/agent-tty version --json
57+
```
58+
59+
## GitHub Release Tarballs
60+
61+
### Direct release asset install
62+
63+
```bash
64+
VERSION=<version>
65+
RELEASE_TAG="v${VERSION}"
66+
RELEASE_TGZ="agent-tty-${VERSION}.tgz"
67+
TARBALL_URL="https://github.com/coder/agent-tty/releases/download/${RELEASE_TAG}/${RELEASE_TGZ}"
68+
69+
npm install -g "$TARBALL_URL"
70+
agent-tty version --json
71+
```
72+
73+
### Authenticated or private release install
74+
75+
```bash
76+
VERSION=<version>
77+
RELEASE_TAG="v${VERSION}"
78+
RELEASE_TGZ="agent-tty-${VERSION}.tgz"
79+
80+
gh release download "$RELEASE_TAG" --repo coder/agent-tty --pattern "$RELEASE_TGZ"
81+
npm install -g "./$RELEASE_TGZ"
82+
agent-tty version --json
83+
agent-tty --home "$(mktemp -d)" doctor --json
84+
```
85+
86+
### Project-local tarball install
87+
88+
```bash
89+
VERSION=<version>
90+
RELEASE_TGZ="./agent-tty-${VERSION}.tgz"
91+
92+
npm install "$RELEASE_TGZ"
93+
./node_modules/.bin/agent-tty version --json
94+
```
95+
96+
## Local Tarball From Source
97+
98+
When you need a deterministic local artifact before publishing a GitHub Release, build a tarball from a checkout:
99+
100+
```bash
101+
TARBALL_DIR=$(mktemp -d)
102+
npm ci
103+
npm run pack:private -- --pack-destination "$TARBALL_DIR"
104+
105+
INSTALL_PREFIX=$(mktemp -d)
106+
npm install -g --prefix "$INSTALL_PREFIX" "$TARBALL_DIR"/*.tgz
107+
"$INSTALL_PREFIX"/bin/agent-tty version --json
108+
"$INSTALL_PREFIX"/bin/agent-tty --home "$(mktemp -d)" doctor --json
109+
```
110+
111+
`npm run pack:private` rebuilds `dist/` before packing.
112+
Release automation uses `npm run pack:release` after the CI-quality build step so GitHub Releases and npm publishing reuse the same verified tarball plus checksum.
113+
114+
## Git Source Install
115+
116+
```bash
117+
npm install -g github:coder/agent-tty
118+
agent-tty version --json
119+
```
120+
121+
Git installs run npm's `prepare` hook and build from source.
122+
Use this only when you explicitly want the latest default-branch snapshot and your npm/git-dependency environment can build native dependencies such as `node-pty`.
123+
124+
If your shell setup injects `mise activate` or another trust-checked tool into npm lifecycle subprocesses, trust the checkout path first or prefer the npm package or release tarball route.

docs/README.md

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,28 @@
1-
# Contributor and maintainer docs
1+
# Documentation
22

3-
Use this directory when you need project workflow guidance rather than product-facing documentation.
3+
Use the root [`README.md`](../README.md) as the product-facing front door.
4+
Use this directory for focused user, contributor, and maintainer guides.
5+
6+
## Users
7+
8+
- [`INSTALL.md`](./INSTALL.md) — npm, release tarball, source tarball, and git install paths.
9+
- [`USAGE.md`](./USAGE.md) — CLI workflows, command groups, examples, and anti-patterns.
10+
- [`AGENT-SKILLS.md`](./AGENT-SKILLS.md) — packaged agent skill usage and loader-specific installation notes.
11+
- [`TROUBLESHOOTING.md`](./TROUBLESHOOTING.md) — environment, Playwright/Chromium, renderer, and platform troubleshooting.
12+
13+
## Product Scope
14+
15+
- [`../RELEASE.md`](../RELEASE.md) — supported product contract for the current release line.
16+
- [`../ROADMAP.md`](../ROADMAP.md) — intentionally deferred work and post-release direction.
17+
- [`../CHANGELOG.md`](../CHANGELOG.md) — per-release changes.
18+
19+
## Contributors
420

5-
- [`../README.md`](../README.md) — product overview and quick start.
6-
- [`../RELEASE.md`](../RELEASE.md) — supported product contract.
7-
- [`../ROADMAP.md`](../ROADMAP.md) — deferred work and post-release direction.
8-
- [`../design/README.md`](../design/README.md) — architecture and design references.
921
- [`CONTRIBUTING.md`](./CONTRIBUTING.md) — setup, validation, and day-to-day contribution flow.
22+
- [`../design/README.md`](../design/README.md) — architecture and design references.
23+
- [`../dogfood/CATALOG.md`](../dogfood/CATALOG.md) — curated proof bundles and recommended review paths.
24+
25+
## Maintainers
26+
1027
- [`RELEASE-PROCESS.md`](./RELEASE-PROCESS.md) — maintainer release checklist and proof expectations.
1128
- [`../.agents/skills/release-maintainer/SKILL.md`](../.agents/skills/release-maintainer/SKILL.md) — thin internal agent wrapper around the canonical release process.
12-
- [`../dogfood/CATALOG.md`](../dogfood/CATALOG.md) — curated proof bundles for review.

docs/TROUBLESHOOTING.md

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# Troubleshooting
2+
3+
Start with `doctor --json` against the same home you will use for the workflow:
4+
5+
```bash
6+
AGENT_HOME="$(mktemp -d)"
7+
agent-tty --home "$AGENT_HOME" doctor --json
8+
```
9+
10+
The `doctor` command checks runtime, filesystem, PTY, socket, artifact, event-log, Playwright, browser-cache, `ghostty-web`, and screenshot viability.
11+
12+
## Chromium Or Browser Cache Missing
13+
14+
Screenshots and WebM exports require Playwright/Chromium.
15+
Install Chromium once in the environment:
16+
17+
```bash
18+
npx playwright install chromium
19+
```
20+
21+
If your environment uses a custom browser cache, expose it with `PLAYWRIGHT_BROWSERS_PATH` and rerun:
22+
23+
```bash
24+
PLAYWRIGHT_BROWSERS_PATH=<path> agent-tty --home "$AGENT_HOME" doctor --json
25+
```
26+
27+
## Renderer-Backed Commands Fail
28+
29+
Affected commands usually include:
30+
31+
- `screenshot`
32+
- `record export --format webm`
33+
- renderer-dependent `wait` modes
34+
- semantic `snapshot` paths that need rendered terminal state
35+
36+
Check `doctor --json` for:
37+
38+
- `playwright_available`
39+
- `browser_cache_accessible`
40+
- `browser_launch`
41+
- `ghostty_web_available`
42+
- `screenshot_viable`
43+
44+
If these fail in CI or a container, install Chromium during setup and make sure the cache is readable by the process running `agent-tty`.
45+
46+
## Isolated Homes
47+
48+
Use `--home <path>` for automation, tests, CI, and agent workflows:
49+
50+
```bash
51+
AGENT_HOME="$(mktemp -d)"
52+
agent-tty --home "$AGENT_HOME" doctor --json
53+
```
54+
55+
Pass the same `--home` value to every command in the workflow.
56+
Do not mix `--home` and `AGENT_TTY_HOME` values unless you intentionally want separate session stores.
57+
58+
## Native Dependency Build Failures
59+
60+
`agent-tty` depends on `node-pty`.
61+
The npm package and release tarball are the preferred install routes because they use packaged artifacts.
62+
Direct git installs build from source through npm's `prepare` hook and are best-effort.
63+
64+
If a git install fails because native dependencies cannot build, use:
65+
66+
```bash
67+
npm install -g agent-tty
68+
```
69+
70+
or install a GitHub Release tarball as described in [`INSTALL.md`](./INSTALL.md).
71+
72+
## Platform Notes
73+
74+
- Linux is tier-1 and CI-tested on `ubuntu-latest`.
75+
- macOS is tier-1 and CI-tested on `macos-latest`.
76+
- Windows is tier-2 and not CI-tested. PTY behavior uses ConPTY when available, and rendering or terminal behavior may differ.
77+
78+
## Reference Rendering Caveat
79+
80+
`ghostty-web` is the reference renderer for snapshots, screenshots, and replay video.
81+
It gives repeatable artifacts for review and automation, but it does not guarantee exact native-terminal pixel parity.
82+
83+
If a bug depends on a specific native terminal emulator, keep the `agent-tty` artifact as reference evidence and capture native-terminal evidence separately when needed.

0 commit comments

Comments
 (0)