| name | maintain-directed-contexts |
| description | Audit and maintain this repository's directed contexts: run validation, detect drift between the codebase and the context set, and apply split/merge/re-review fixes. Use when asked to audit agent contexts, fix context drift, update AGENTS.md routing, or after adding/removing a package. |
| compatibility | Requires Go toolchain (1.22+) for contextctl. |
| metadata | {"author":{"AUTHOR":null},"version":"0.1"} |
Maintain Directed Contexts — {REPO_NAME}
Keep this repository's context set (root AGENTS.md + .subagents/*.md)
matching the codebase. The codebase is the state; the router is the map; when
they disagree, the codebase wins.
Entry Point
Inspect: Run validation and drift detection:
go run {CONTEXTCTL_PATH} check --repo .
go run {CONTEXTCTL_PATH} drift --repo . {DRIFT_FLAGS}
Determine Action
| Finding | Action |
|---|
| All clean | Report healthy; optionally re-date guides reviewed today |
| Broken link / missing section | Fix the Markdown; re-run check |
| New unowned package | Assign to an existing context, or propose a new one to the user |
| Owned path deleted or renamed | Update the owning context's ## Owned paths globs |
| Overlapping ownership | Present both claims; user picks the single primary owner |
| Stale review date | Re-read the guide against the code; fix discrepancies; re-date |
| Verification command missing | Replace with a command that exists in this repo |
| Context above split threshold | Propose a split along a behavioral boundary; user confirms |
| Context below merge threshold | Propose a merge with its closest adjacent context; user confirms |
Route-Case Upkeep
go run {CONTEXTCTL_PATH} routes --repo . --cases .subagents/route-cases.json
- Fix failing cases: decide whether the glob or the expectation is wrong,
against the codebase.
- After any observed agent misroute, add a route case reproducing it.
- Retire cases naming contexts that no longer exist.
Rules
- Never let a policy overlay claim exclusive paths.
- Never duplicate root universal rules into domain contexts.
- Every guide touched gets today's
Last reviewed: date.
- Land audits as one PR with
check, routes, and drift clean.
- This skill edits only
AGENTS.md, .subagents/, and itself — never domain
source code.
Current Context Set
| Context | Kind |
|---|
| {CONTEXT_LIST_ROWS} | |