Agent First Run
Agent First Run
Section titled “Agent First Run”Start agents from the app map, focused query packets, write scope, and proof commands instead of broad repository reads.
Status: current Audience: coding agents and humans supervising agents Use when: an agent is entering a Topogram project and needs safe read order, commands, and edit boundaries.
Agents should start from the project briefing and focused query packets. The goal is to understand the smallest useful part of the app map, the allowed write scope, and the proof commands before reading broad repository context or editing code.
First command
Section titled “First command”topogram agent brief --jsonGenerated projects expose the same command as:
npm run --silent agent:briefagent brief is read-only. It validates the Topogram and project config but
does not generate apps, write files, load generator adapters, or execute
template implementation code.
Read order
Section titled “Read order”AGENTS.mdREADME.mdtopogram.project.jsontopogram.sdlc-policy.json, when presenttopogram.template-policy.json, when presenttopogram.generator-policy.json, when present.topogram-template-trust.json, when executable implementation exists.topogram-extract.json, when the project came from brownfield extract/adopt- Focused
topogram query ... --jsonoutput
First command sequence
Section titled “First command sequence”topogram agent brief --jsontopogram query list --jsontopogram query show <name> --jsontopogram check --jsonIf the project has adopted SDLC and the work is tied to a task or bug, add:
topogram query sdlc-grooming ./topo --jsontopogram query sdlc-backlog ./topo --jsontopogram query sdlc-available ./topo --jsontopogram query sdlc-ready ./topo --jsontopogram sdlc explain <task-id> --jsontopogram sdlc start <task-id> . --actor <actor-id> --jsontopogram sdlc start <task-id> . --actor <actor-id> --write --jsontopogram query slice ./topo --task <task-id> --jsontopogram query sdlc-proof-gaps ./topo --task <task-id> --jsontopogram query verification-runs ./topo --task <task-id> --jsonThe first sdlc start command is read-only and returns the task-start packet.
Use --write only after reviewing blockers, ownership, decisions, rules,
plans, and verification targets in that packet.
For journey-oriented workflow context:
topogram query slice ./topo --journey journey_greenfield_start_from_template --jsonFor implementation planning:
topogram query single-agent-plan . --mode modeling --capability <capability-id> --jsonBefore commit in an SDLC-adopted project:
topogram query sdlc-proof-gaps ./topo --task <task-id> --jsontopogram sdlc prep commit . --base origin/main --head HEAD --jsontopogram sdlc gate . --base origin/main --head HEAD --require-adopted --jsonEdit boundaries
Section titled “Edit boundaries”Safe default source edits:
topo/**topogram.project.json- policy files after review
implementation/**only after reviewing trust state
Generated-owned outputs such as app/** are replaceable. Do not make durable
edits there unless the output ownership is maintained.
Generated project first-run commands
Section titled “Generated project first-run commands”Generated projects usually expose these local scripts:
npm run agent:briefnpm run doctornpm run source:statusnpm run template:explainnpm run generator:policy:checknpm run checknpm run generatenpm run verifyUI and widgets
Section titled “UI and widgets”For UI work, inspect widget and surface packets:
topogram widget check ./topo --projection proj_web_surfacetopogram widget behavior ./topo --projection proj_web_surface --jsontopogram emit ui-widget-contract ./topo --jsonui_contract owns semantic UI. Concrete web/native surfaces inherit it and own
routes and surface hints.
Slices and vocabulary
Section titled “Slices and vocabulary”Context slices are intended to be cold-start safe without copying the full
agent brief into every packet. Slices include focused dependencies, standing
rule references, mode-specific next commands, and glossary terms explicitly
linked through related_terms or entity uses_terms.
Each slice includes a slice_manifest that tells an agent what is must-read,
reference-only, proof context, or diagnostic context. Use --detail compact
when you need the shortest safe packet, standard for normal work, and full
when reviewing or debugging the slice itself.
topogram query slice ./topo --mode implementation --task <task-id> --jsontopogram query slice ./topo --mode implementation --task <task-id> --detail compact --format markdowntopogram emit glossary ./topo --jsonBrownfield extract/adopt
Section titled “Brownfield extract/adopt”Before running a package-backed extractor, identify and check the package:
topogram extractor listtopogram extractor show @topogram/extractor-react-routernpm install -D @topogram/extractor-react-routertopogram extractor policy inittopogram extractor policy pin @topogram/extractor-react-router@1topogram extractor check @topogram/extractor-react-routerThe policy pin uses the extractor manifest version, not the npm package
version. topogram extractor list, show, check, and policy status report
manifest version, installed package version, compatible CLI range, and policy
pin state before package-backed execution. topogram extractor check proves the
package boundary can load and run a minimal smoke extraction; it does not prove
that the package understood the target app. That proof comes from extract/adopt
review packets.
When .topogram-extract.json exists:
topogram extract check . --jsontopogram extract diff . --jsontopogram extract plan . --jsontopogram adopt --list . --jsontopogram query extract-plan ./topo --jsontopogram query single-agent-plan ./topo --mode extract-adopt --jsontopogram query multi-agent-plan ./topo --mode extract-adopt --jsontopogram query work-packet ./topo --mode extract-adopt --lane adoption_operator --jsontopogram extract status . --jsontopogram extract history . --verify --jsonUse workspaceRoot from import JSON as the canonical project-owned workspace
path.
In extract/adopt mode, query packets include extraction_context when
.topogram-extract.json is present. That context tells an agent which
package-backed extractors ran, how many candidates they produced, where the
trusted extraction record lives, and which review/adoption commands are safe to
run next. Treat extractor output as evidence until topogram adopt ... --write
promotes reviewed candidates.
Use query packets before raw topo/candidates/** files unless you need the
evidence details for a specific candidate.
Command-owned state
Section titled “Command-owned state”Use commands for stateful workflow mutations:
topogram sdlc transitiontopogram sdlc plan step ... --writetopogram sdlc archivetopogram trust ...topogram extract ...topogram generatetopogram emit --writetopogram release ...
Declarative .tg source may be edited directly. Status history, provenance,
trust hashes, generated sentinels, archives, and release evidence should not be
hand-edited to make checks pass.