Agent workflow
The default agent workflow is retrieve-first: pull the team’s context for the task before you touch the area, then persist what you learned.-
Retrieve context before editing. Pick the first move by what you know:
- You know the files →
driftless context get --files "src/auth/guard.ts,src/auth/service.ts"(drift shows as a freshness badge inline; nosyncneeded). - You know the topic →
driftless context get <slug>. - You have a task but no slug → reach for the unified retrieve primitive:
driftless_context_retrieve(MCP) orPOST /topics/retrieve(API). It ranks search + match-files + list filters drifted-first and returnsbriefbodies (the durable why); calldriftless context get <slug>for the one full body you need.
what / how / gotchas / decisions / invariantsand thegovernance.authoritativeflag. - You know the files →
-
If no topic exists, create one:
driftless context add "my-area" --area <domain> --pattern "src/<module>/**" --content "..."(it lands as a Note). -
Persist what you learned:
driftless context update <slug> --gotcha "..." --decision "..."; for a topic that’s already Knowledge, open a Suggested edit instead:driftless context pr <slug> --open --summary "..." --content @file. -
Add relations if useful:
driftless context update <slug> --rel depends_on:other-topic. -
Use JSON output when acting as an agent:
driftless context get <slug> --json.
reviewed). Treat reviewed as truth, draft/proposed as a hint. (An agent can run that merge, but only when an owner/admin explicitly asks.) See Governance.
Summary / brief / full: keep reads fast
Reads default to a light payload so a result never floods the agent’s context.retrieve and context get --files return brief bodies (what / decisions /
gotchas / invariants, no full content); a single context get <slug> returns the
full body because you named it; lists and search return a summary index
row, bounded. Ask for full (e.g. --full / view: "full") only when you need
the whole body, and pair it with a small limit. The pattern is brief to find the
right topic, full for the one body you actually need.
Acting on operational records (Collections)
A Collection (CRM, tracker, content calendar) holds typed records. Before acting on a record, read the collection’s criterion Knowledge, the team’s “how we do this.” Theretrieve action gets relevant records plus that
criterion in one call:
Operating an integration (Broker)
If the work needs an external provider that’s already connected, operate it through the broker, not by writing a script:driftless integration connect/confirm, or the dashboard), a separate, human-led concern. If the
operation you need is not in broker operations <provider>, stop and report
the missing capability. Do not author or deploy an integration script to fill
the gap.
Install the agent skill
What gets installed
The managed block inside
AGENTS.md and CLAUDE.md is wrapped in comments:
1
Detect situation
Agent runs
driftless doctor to check API key, workspace, Git remote, and skill installation.2
Retrieve context before editing
--json for structured output.3
Persist discoveries
Self-healing
Runningdriftless install-skill again replaces the managed block contents without touching anything outside it. This means you can update the skill instructions without manual editing: re-run the command and the block refreshes to the latest version.
What to write back
Use Driftless for durable architecture knowledge:- Decisions: why the code works this way
- Gotchas: traps that would cause a future agent to make a bad edit
- Invariants: rules that must stay true across refactors
- Anchors: new or corrected file patterns after code moves
- Relations: cross-repo dependencies discovered while working
