External Project Setup
This page is where you go after install-and-run.md when you want to attach Agent Tracer to another project — not the agent-tracer repo itself.
1. What is supported today
| Runtime | Automated setup | Still manual | Next doc |
|---|---|---|---|
| Claude Code | yes (npm run setup:external) | MCP server registration | claude-setup.md |
| Other runtimes | no | HTTP + MCP calls directly | runtime-capabilities.md |
Important points:
setup:externalonly touches Claude Code settings today.- It does not copy hook source files, bootstrap custom runtimes, or install the plugin permanently into the target project.
- The Agent Tracer source stays in this repository. The target project only gets a
.claude/settings.jsonand (via--plugin-dir) a runtime reference to the plugin path.
2. Prerequisites
- You have already finished install-and-run.md.
- The monitor server is running and
curl -sf http://127.0.0.1:3847/api/overviewreturns 200. - You have a target project path (e.g.
/absolute/path/to/your-project). - For Claude Code, you can launch the
claudeCLI in that target directory.
3. Run setup:external
From the Agent Tracer repository root:
npm run build # only needed if you haven't built yet
npm run setup:external -- --target /absolute/path/to/your-projectThe only required argument is --target. The script:
- creates or merges
target-project/.claude/settings.json - strips any legacy
hooksblock (the plugin owns registration now) - sets
permissions.defaultMode = "acceptEdits"andpermissions.allow = ["WebSearch", "WebFetch"] - prints the absolute path of the Agent Tracer plugin and the
claude --plugin-dir …command to use
Expected output:
[claude] Plugin path: /absolute/path/to/agent-tracer/.claude/plugin
[claude] Run Claude Code with: claude --plugin-dir /absolute/path/to/agent-tracer/.claude/pluginThe script also parses
--monitor-base-url,--source-repo,--source-ref, and--source-root, but these are not currently used for vendoring — the plugin is referenced directly from this repository.
4. Attach Claude Code
Follow claude-setup.md sections 2 and 3 to:
- Launch Claude Code with
claude --plugin-dir …(or via the marketplace). - Register the
monitorMCP server withclaude mcp add monitor ….
5. Attach other runtimes (manual)
There is no automated bootstrap for non-Claude runtimes. Instead, call Agent Tracer's HTTP API or MCP tools directly. Minimum implementation order:
/api/runtime-session-ensure(or/api/task-start)/api/user-message/api/tool-used/api/explore/api/assistant-response/api/runtime-session-end(or/api/session-end)
Add /api/terminal-command, /api/todo, /api/save-context, /api/agent-activity, /api/async-task, /api/task-link, /api/question, and /api/thought as the runtime's capability allows.
References:
- api-integration-map.md — every endpoint mapped to the hook that calls it and its manual-runtime meaning
- runtime-api-flow-and-preprocessing.md — preprocessing rules applied inside each endpoint
- runtime-capabilities.md — what capability flags mean when you register a new runtime
6. Common pitfalls
- Stale
npm run build— after modifyingpackages/mcpor the plugin, rebuild before launching Claude. - Missing
nodeon GUI PATH — when launching Claude Code from a macOS launcher, use the absolute node binary path inclaude mcp add. - Env vars not inherited — Claude Code launched from a GUI does not see shell env vars; launch it from a terminal, or use
launchctl setenvon macOS. - Changes to
.claude/settings.json— restart Claude Code after editing so it picks up the new permissions and plugin path.
7. Quick end-to-end check
- Monitor server running and healthy.
npm run setup:external -- --target /abs/path/to/target.claude mcp add monitor …completed.- Open the target project with
claude --plugin-dir …. - Do one read or edit inside Claude.
- The dashboard at
http://127.0.0.1:5173shows a new task with the matching event in its timeline.