Auto Detect Configure - alexherrero/agentm GitHub Wiki
Why the first conversation in a repo the harness hasn't seen configures itself instead of demanding a manual setup script โ and why the result lands in project.json. For the operator steps, see Configure a new project; for the rule list and the schema, see Detection rules and Project config.
Before this work, opening a fresh repo meant remembering to run a manual setup script to tell the harness which skills and hooks the project should use. The friction was real: most repos never got configured, so per-project enablement never had teeth. The promise of the device-wide install arc was that the harness should configure itself on first contact โ and this closes it.
Now, opening an unconfigured code project surfaces a single quiet line offering to set it up. Say "configure this project" (or run /setup --detect) and you get a scannable proposal โ every skill and hook, each with one plain-language reason it's relevant to this repo โ and a three-way choice: take it all, customize, or skip. Approve, and a durable enablement block lands in project.json so every later phase can resolve this repo's shape without asking again. The operator stays in control; the harness just removes the "where do I start" tax.
Three cooperating pieces make this work, kept deliberately separate so the interactive part stays agent-driven and the deterministic part stays testable:
SessionStart hook โโnudgeโโโถ operator says "configure" / runs /setup --detect
(one line, non-interactive) โ
โผ
detect_project.detect(cwd) โโ deterministic, no I/O
โ ProposedConfig (verdict: propose | bypass)
โผ
render_text() โโโถ a/b/c approval (agent renders verbatim)
โ
โผ
project_config.register(cwd) โโ writes project.json + repo_registry
Here are the calls that matter, and why each is what it is:
-
Enablement config lives in
project.json, notfeatures.json.features.jsonis the governed verification ledger (thepasses: true|falsecontract); enablement is a different concern with a different lifecycle. Co-mingling them would let a registration write touch the ledger. The block is additive alongside the existingvault_project/github/envkeys. - The nudge extends the existing SessionStart hook, not a new one. It rides the hook's "nothing resolved" else-branch, preserving the original inject-vault-paths behaviour rather than duplicating it.
-
The hook only nudges; scan/propose/approve/write is agent-driven. Hooks are non-interactive โ they emit one line into context. All the gating logic lives in
project_config.pyso the decision stays unit-testable and the hook stays a thin emitter. -
Detection augments
/setup; it doesn't replace it. The scan is the new ยง0 at the front of/setup, ahead of the inventory and interview. -
Default-all-enabled. Detection never gates which skills or hooks are present โ it surfaces rationale so the operator can make an informed opt-out. Opt-outs are recorded in
operator_overrides. - The permeable boundary. Detection proposes; the operator approves or edits; nothing is ever written to the vault silently.
-
Re-detection surfaces a diff; it never applies one. A repo changes after you configure it, so
/setup --redetectre-scans and shows what moved. The default run writes nothing but thelast_redetect_atstamp, and--applyrefreshes only the rationale โ it never flips anenabledflag. Turning something off stays an operator decision recorded as an override, which is why an existing override suppresses any suggestion about its target instead of re-raising a choice you already made. See Re-detect a configured project.
Nudge fatigue is the main one, mitigated by keeping the nudge to a single line and honouring the .agentm-no-register escape hatch โ drop that marker for a one-time scratch session and the hook stays silent. A .envrc (direnv) file is a known false positive; the operator declines it at approval, and the decline is recorded so re-detection won't re-suggest it. If the vault is unavailable, detection still renders the proposal but skips the persist, noting it.
Deliberately deferred (do not treat as shipped): the pluggable rule API, per-project rule disabling, the project-type taxonomy, and monorepo sub-project registration.
- Configure a new project โ the operator recipe.
- Re-detect a configured project โ re-running the scan after the repo changes.
- Detection rules โ the built-in rules and what each attaches a rationale to.
- Project config โ the enablement-block schema.
- Orchestration and auto-detection โ where this sits in the architecture.