/ai-literacy-habitat:harness-initfrom ai-literacy-habitat
Guides project setup by discovering the tech stack and existing tooling, then generating a HARNESS.md with conventions, constraints, CI config, and observability. Re-run to add features incrementally.
Ships in ai-literacy-habitat. Installing the plugin adds it to Claude Code.
Set up a living harness for this project. Choose which features to configure — context engineering, constraints, garbage collection, CI, and observability — then walk through a guided conversation for each. Re-run at any time to add features incrementally; existing configuration is preserved.
Read the harness-engineering and context-engineering skills from
this plugin before proceeding. They provide the conceptual framework
and convention-writing guidance needed for this conversation.
Dispatch the harness-discoverer agent to scan the project. Wait for
its discovery report before proceeding.
Also check whether HARNESS.md already exists. If it does, note which
sections contain real content (not the placeholder marker
<!-- Not yet configured. Run /harness-init and select this feature to set up. -->).
Pass this information to the feature selection step so it can set
appropriate defaults.
Show the user what was discovered:
Frame this as: "Here's what your project already has. Let's build on it."
Present a feature selection menu. The six selectable areas are:
| Feature | What it configures | Default (first run) |
|---|---|---|
| Context engineering | Stack declaration + conventions | on |
| Architectural constraints | Enforcement rules + secret detection | on |
| Garbage collection | Periodic entropy checks | on |
| CI configuration | GitHub Actions workflow + auto-enforcer | on |
| Observability | README badge + status section | on |
| Affordances | Declared-tool inventory (## Affordances section) | off |
First run (no HARNESS.md exists): all features default to on except
Affordances, which is opt-in (default off) — most projects adopt it later
via /harness-affordance discover once they have a populated permissions
allowlist to scan. The user can turn it on here.
Re-run (HARNESS.md exists): detect which sections are already
configured by checking for the placeholder marker
<!-- Not yet configured. Run /harness-init and select this feature to set up. -->
in each section. Already-configured sections default to off (skip).
Unconfigured sections default to on. The user can toggle any combination.
Tell the user: "All features are selected by default. Deselect any you want to skip for now — you can always add them later by re-running /harness-init."
On re-run, tell the user which features are already configured and frame unconfigured features as recommendations: "These features aren't set up yet. I recommend adding them."
Gate: only run this step if "Context engineering" was selected in step 3. If not selected, skip to the next step silently.
Ask the user about their conventions, one topic at a time. Use the discovery report to make informed suggestions. Cover:
For each topic, offer concrete options based on what the discoverer
found. Use the convention patterns from the context-engineering skill
to ensure conventions are enforceable.
Gate: only run this step if "Architectural constraints" was selected in step 3. If not selected, skip to the next step silently.
For each convention, ask whether the user wants it enforced. For each that should be enforced:
deterministicunverifiedAsk about scope: should this check run at commit time (fast feedback), PR time (strict gate), or weekly (periodic sweep)?
The template includes a "No secrets in source" constraint. During setup:
gitleaks is available: command -v gitleaksdeterministic with gitleaks as the tool. Ask if they want to
customise the configuration (e.g. add allowlist paths). Offer to
run an initial scan: gitleaks detect --source . --no-bannerunverified. Suggest installation:
brew install gitleaksgo install github.com/gitleaks/gitleaks/v8@latest/harness-init or use /harness-constrain to promoteEither way, tell the user what happened and allow them to override.
Read the secrets-detection skill from this plugin for full gitleaks
guidance if the user asks questions about configuration or scanning.
Gate: only run this step if "Garbage collection" was selected in step 3. If not selected, skip to the next step silently.
Ask whether the user wants periodic checks for:
For each, set frequency and auto-fix preference.
First run (no HARNESS.md exists):
Read the template from ${CLAUDE_PLUGIN_ROOT}/templates/HARNESS.md.
For each selected feature, replace placeholder values with discovered
facts and user responses as before. For each unselected feature, replace
the section body with the placeholder marker:
<!-- Not yet configured. Run /harness-init and select this feature to set up. -->
Affordances is opt-in: if unselected (the default), replace the
## Affordances section body with the placeholder marker like any other
unselected feature. If selected, keep the section's example entries and
schema comments in place and tell the user to run
/harness-affordance discover to populate it from their real config.
Write the result to HARNESS.md at the project root.
Re-run (HARNESS.md exists):
Read the existing HARNESS.md. For each selected feature, replace the
corresponding section (## Context, ## Constraints,
## Garbage Collection, ## Affordances, or ## Status) with freshly
generated content from user responses. For unselected features, preserve
the existing section content verbatim — do not modify it. If the
Affordances feature is newly selected on a project that lacks the
section, insert ## Affordances from the template immediately before
## Observability (i.e. directly after the ## Garbage Collection
section), matching the template's section order, without touching the other
sections.
Section boundaries are defined by every ## heading in the template, in
order: ## Context, ## Constraints, ## Garbage Collection,
## Affordances, ## Observability, ## Read-side filtering, ## Status.
Each section runs from its ## heading to the next ## heading or end
of file — so the section after ## Affordances is ## Observability, not
## Status.
Template version marker (both first run and re-run):
After writing HARNESS.md, ensure it contains a <!-- template-version: X.Y.Z -->
comment on its own line immediately after the intro comment block,
where X.Y.Z is the current plugin version read from
${CLAUDE_PLUGIN_ROOT}/.claude-plugin/plugin.json. If the marker
already exists, update it to the current version. If it does not
exist, insert it after the line containing
https://martinfowler.com/articles/exploring-gen-ai/harness-engineering.html -->.
This step is mandatory. After writing HARNESS.md, read it and
verify its structure against templates/HARNESS.md.
Structural checks:
## Context,
## Constraints, ## Garbage Collection, ## Observability
(## Affordances is optional — see check 6 — and ## Read-side filtering and ## Status are validated by checks 3-4)### Stack and ### Conventions
subsections (either with content or the placeholder marker)### Operating cadence,
### Health thresholds, and ### Regression detection
subsections## Status section present with all 4 fields: Last audit,
Constraints enforced, Garbage collection active, Drift detected<!-- template-version: X.Y.Z --> where X.Y.Z matches the
current plugin version## Affordances is only required when the
Affordances feature was selected. If selected, the section is present
(with example entries or the placeholder marker) and sits between
## Garbage Collection and ## Observability (its template position).
If not selected, its absence is not a failure.If any check fails, fix HARNESS.md in place:
Do not re-run the init conversation. Fix the output directly.
Gate: only run this step if "CI configuration" was selected in step 3.
Dependency: CI configuration requires constraints to exist. If
"Architectural constraints" was not selected in step 3 and no
## Constraints section exists in HARNESS.md (or it contains only the
placeholder marker), tell the user: "CI configuration requires at least
one constraint to enforce. Skipping CI setup — run /harness-init again
after adding constraints." Then skip to the next step.
If constraints exist (either just configured or from a previous run), proceed with the existing CI generation logic:
If GitHub Actions was detected (or the user confirms it), read the
template from ${CLAUDE_PLUGIN_ROOT}/templates/ci-github-actions.yml.
Add deterministic tool steps for each PR-scoped deterministic
constraint. Write to .github/workflows/harness.yml.
If no CI was detected, offer the generic script from
${CLAUDE_PLUGIN_ROOT}/templates/ci-generic.sh.
After generating harness.yml, check whether the HARNESS.md being
produced contains any agent-scoped PR constraints. If it does:
${CLAUDE_PLUGIN_ROOT}/templates/ci-auto-enforcer.yml
to .github/workflows/auto-enforcer.yml as part of the init commitANTHROPIC_API_KEY secret to their
repository before the first PR: Settings > Secrets and variables >
Actions > New repository secretauto-enforcer-action skill from this plugin for full
setup guidance if the user asks questionsIf no agent PR constraints exist, skip this offer silently.
Gate: only run this step if "Observability" was selected in step 3.
Dependency: the badge requires HARNESS.md to exist with at least one configured section. If HARNESS.md contains only placeholder markers (no real content was generated), tell the user: "No harness features configured yet — skipping badge. Run /harness-init to add features first." Then skip to the next step.
If HARNESS.md has content, proceed with badge generation as before:
Add the harness badge to the project's README.md. Run the update-badge
command (a plugin bin/ shim, on PATH) or insert
manually:
[](HARNESS.md)
Stage and commit all generated files:
Commit message: "Initialize project harness with HARNESS.md"
If the project is hosted on GitHub, add the agent-harness-enabled
topic tag to the repository:
gh repo edit --add-topic agent-harness-enabled 2>/dev/null
This tag signals to portfolio assessments and other tooling that the
repo has a harness. If gh is not available or the command fails
(not a GitHub repo, no permissions), skip silently.
Also add the badge to the README if not already present:
[](HARNESS.md)
Tell the user:
/harness-constrain to add more rules,
/harness-status to check health, /harness-audit to verify
enforcementWhat the command file sets; muted values are Claude Code's defaults
7-day visitors to each command page
npx claudepluginhub joshedwards237/ai-literacy-habitat --plugin ai-literacy-habitat29 commands in this plugin
/assessRun an AI literacy assessment — scan the repo for evidence, ask clarifying questions, produce a timestamped assessment document, apply immediate habitat fixes, recommend workflow changes, capture a reflection, and add a literacy level badge to the README/carpaccioRun the carpaccio agent (cadence governor) on a task description — produces a slicing record at docs/superpowers/slices/<task-slug>.md; use at orchestrator step 0 or before spec-writer when running manually/choice-cartographRun the Choice Cartographer (decision-archaeology agent) on a spec — produces the choice-story record at docs/superpowers/stories/<slug>.md; use after spec-mode /diaboli dispositions are resolved, before plan approval/convention-syncSync HARNESS.md conventions to Cursor, Copilot, and Windsurf convention files/cost-captureCapture AI tool cost data — guide through provider dashboards, record spend and token usage, compare to previous snapshot, update MODEL_ROUTING.md/cost-estimateEstimate a target's tokens, agent-compute time, and (when grounded) cost before it runs — the prospective sibling of /cost-capture. Dispatches the read-only cost-estimator agent, validates the returned record, and writes it after you dispose.Other plugins' commands for the same job