Initialize this project for the autonomous engineering workflow (tbv/ folder, project config, git discipline). Use when setting up a new project for the Autonomous Engineering Protocol, or when asked to run /init-codebase.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Init Codebase?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/restierecon-init-codebase)
---
name: init-codebase
description: Initialize this project for the autonomous engineering workflow (tbv/ folder, project config, git discipline). Use when setting up a new project for the Autonomous Engineering Protocol, or when asked to run /init-codebase.
---
Initialize this project for the autonomous workflow. Do all of the following.
Re-running on an existing tbv/ folder upgrades it: never overwrite an existing file, create
only what is missing, and always run step 6 and the configure-gates skill (step 11).
1. Verify this is a git repo (`git rev-parse`); if not, `git init`.
2. Verify `.env` and `.env.*` are in .gitignore — add them if missing. Never proceed
without this. Also verify `.worktrees/` (parallel-slice git worktrees), `.gate/`
(gate.sh logs) and `tbv/plan-draft.json` (the planner's scratch output,
never source of truth) are gitignored — add them if missing.
3. Create directories: tbv/decisions, tbv/findings, tbv/flags
4. Create tbv/task-tree.json:
{"project": "", "autonomy_note": "dial lives in project.md", "slices_since_arch_review": 0, "slices": []}
5. Create tbv/log.jsonl (empty file) and tbv/stories.md containing only the
header "# Shipped Stories" plus the line "One entry per merged slice, newest last.
task-tree.json holds live work only." — every merged slice is harvested here and
then pruned from task-tree.json. If FEATURES.md is missing at the repo root, create
it (codebase-map skill → Feature map): `# Features`, one line saying it maps every
feature to its code, tests and docs, and a `## project - Project setup` entry whose
`code:` names every top-level file and folder already tracked. Step 12 drafts an
existing codebase's real features.
6. Migration — drop the retired memory layer. If tbv/memory or tbv/handoffs exists:
require a clean working tree (`git status --porcelain` empty; otherwise stop and ask
me to commit first), then `git rm -r` whichever of the two exist and commit that
alone: `git commit -m "chore(tbv): drop memory layer"`. Git history keeps them;
never delete them any other way. Resume state is git + task-tree.json from here on.
7. Create tbv/standing-orders.md: header "# Standing Orders", the line "Numbered;
pasted verbatim into every tester/builder/reviewer/auditor brief (STANDING). Append, never
renumber.", then these starting orders:
1. Work only inside the assigned branch or worktree; never touch main directly.
2. Never edit tbv/task-tree.json or tbv/log.jsonl; return verdicts as text.
3. Run checks only through ~/.tbv/scripts/gate.sh and report the SHA it ran on.
4. No new dependency without a one-line justification in the report.
5. Nearby improvements go in the report as flag candidates, never in the diff.
8. Create tbv/project.md by asking me (one round of questions max) for:
- Project name and one-line purpose
- Stack (suggest from what you see in the repo if it's not empty)
- Every ASK line from `python3 ~/.tbv/scripts/detect-gates.py` (read-only; run
it before asking — `python` on Windows), and a full-suite budget in seconds if
not the default 300. Don't ask for gate commands it already proposes.
Then write it with these sections: Purpose · Stack · Gate — the configure-gates
skill writes and proves the gate lines in step 11, and this is the contract they
follow (the human's ASK answers go in as they said): one line per step, read
by `~/.tbv/scripts/gate.sh`, omit a step the stack doesn't have (except
`gate.test`, which the gate requires — write `- gate.test: none` only if the
project truly has no tests):
`- gate.lint: <cmd>` · `- gate.types: <cmd>` · `- gate.test: <cmd>` (with a
per-test timeout where the runner offers one, e.g. `--timeout=10` with pytest-timeout) ·
`- gate.build: <cmd>` (quiet flags preferred, e.g. `pytest -q`) ·
`- gate.a11y: <cmd>` for a project with a UI — an accessibility check that exits
non-zero on a WCAG 2 AA violation (README → Gate commands has a Playwright + axe line) ·
`- gate.test.focus: <cmd>` with `{}` where test files or ids go (`pytest -q {}`,
`npx vitest run {}`, `go test {}`) — builders run only their own tests mid-loop ·
`- gate.test.budget: <seconds>` — the gate flags a full suite slower than this ·
`{workers}` in any parallel runner's worker flag (`pytest -q -n {workers}`,
`npx jest --maxWorkers={workers}`, `npx vitest run --maxWorkers={workers}` on
vitest 4+ and `--minWorkers=1 --maxWorkers={workers}` on 1-3, `mvn -q -B test -T {workers}`)
— never `-n auto` or a fixed count, so concurrent slice gates can't run the machine
out of memory · `- gate.workers.mb: <MiB>` only as a floor: the gate measures what
one worker peaks at and sizes by the larger ·
`- gate.crap: <cmd>` printing `<path>:<start>-<end> <score> <name>` per function,
usually `~/.tbv/scripts/crap-score.py <coverage report> <src dir>` reading the
report `gate.test` writes (README → CRAP → Per-stack setup has Python, React and Java
lines; gitignore the report) · `- gate.crap.max: 30` ·
`- gate.mutation: <cmd>` printing `<path>:<line> <killed|survived|timeout|no-coverage>
<description>` per mutant (or `no-mutants`), usually the stack's mutation tool piped
through `~/.tbv/scripts/mutation-report.py` (README → Mutation → Per-stack setup;
clear the tool's cache first and gitignore its output) · `- gate.mutation.min: 80`; the
built-in `markers` and `comments` steps need no line, but add
`- gate.comments.skip: <path prefixes>` for generated code (migrations) and
`- gate.comments.directives: <regex>` for a tool directive the gate doesn't know ·
Domain Language (empty table:
Term | Meaning — grow it as the project develops) · Autonomy: supervised ·
Parallelism: max_parallel_slices: 3 (git-worktree parallel dispatch, see global
protocol → Parallel Slice Dispatch) · Definition of Done (every slice independently
testable, no TODO/FIXME, no comments, gates green).
Then add the harness pin: append the line `~/.tbv/scripts/harness.sh pin` prints
(`- harness: <date> (<commit>)`) under the gate lines. A session on a machine whose
install is older than the pin is told to update before it works on this project.
Merge the hook `~/.tbv/scripts/harness.sh project-hook` prints into the project's
`.claude/settings.json` (create the file if absent; keep any hooks already there)
when the project is worked on with Claude Code.
It speaks only on a machine where this setup is not installed, so a teammate or a
fresh cloud container is told what to clone instead of working without guardrails.
If GitHub Copilot's cloud agent will work on this repository, ask the human, then run
`~/.tbv/scripts/cloud-agent.sh` (it writes `.github/workflows/copilot-setup-steps.yml`
and `.github/hooks/tbv.json`; `--with-agents` adds `.github/agents/`).
9. Put the project specifics (dependency install step, anything unusual — gate commands
live in project.md) at the top of AGENTS.md, above the protocol block step 10 writes;
Cursor and Copilot read that file. Claude Code does not: when the project is worked on
with it, also create a project-level CLAUDE.md with the same project specifics and
nothing else — never the protocol, which Claude Code already loads globally.
10. Run `~/.tbv/scripts/agents-md.sh` to put the protocol into AGENTS.md — the file
Cursor and GitHub Copilot read (Claude Code reads its own copy, ~/.claude/CLAUDE.md).
It only manages its own marked block, so an existing AGENTS.md keeps its content, and
the session-start hook keeps the block current after upgrades.
11. Commit: `git add -A && git commit -m "chore: init autonomous workflow"`.
Then run the configure-gates skill (~/.tbv/skills/configure-gates/SKILL.md): it
writes every gate line the repo supports, proves each one on main, and turns the
rest into one SLICE card for /grill and one TOOL card for me.
12. Existing codebase: run `python3 ~/.tbv/scripts/codebase-graph.py build` (codebase-map
skill), read the intent docs its FACTS list, then give me an onboarding brief in the
conversation (≤ 30 lines; nothing written to disk, so nothing goes stale). It covers
what the project says it is, what the code shows (stack, dependencies, entry points,
configuration, delivery), and where the two diverge.
- Every claim cites its evidence: a path from the facts, or a file you read.
- Never infer what files don't show. "Uses Clean Architecture" needs directories
that show it, and a database needs a driver in a manifest.
- Mark what the map couldn't settle as `[TODO]`.
- List every `[ASK USER]` item (the map's plus any divergence that needs intent) as
a numbered question. Those questions open the first /grill.
Draft FEATURES.md from the map: one entry per user-visible feature, naming the
folders and files that implement it and their tests, and narrow the `project` entry
to what no feature owns. A grouping the code doesn't settle is an `[ASK USER]`
question. Move no files: a scattered feature is a refactor slice for later.
Show me `.gate/graph.html`. Offer once to record any boundary I name as a rule in
tbv/architecture.json (the gate's `arch` step skips until that file exists on main).
With `gate.crap` set: run the crap-hotspots skill
(~/.tbv/skills/crap-hotspots/SKILL.md) once for a baseline card in
tbv/flags/pending-review.md, then commit it. Same with `gate.mutation` set: the
mutation-survivors skill (~/.tbv/skills/mutation-survivors/SKILL.md).
13. Optional, offer once: "Run /create-verification-skill to generate
.claude/skills/verify-<project>/ so the reviewer can drive the real app?" Run it only
on a yes (needs a runnable app — skip for an empty repo); never re-ask in later sessions.
14. Confirm to me: tbv/ ready, autonomy dial at `supervised`, risk gate on with the
default thresholds (to change them, I create tbv/risk-policy.json myself — the
risk-gate skill shows the shape; agents can't write it), and suggest running
/grill on the first feature before any decomposition.