Deterministic control layer for AI-assisted development.
Hooks are not active until you run the installer. Do this once per clone:
- Install hooks:
python scripts/install-hooks.py(setscore.hooksPath=.githooks) - Get next step:
python scripts/conductor.py - After making a change, stage it, then run reviewer and commit:
Pre-commit runs
git add -A python scripts/wf.py reviewer --run-id <your-id> --cmd "python scripts/conductor.py" git commit -m "your message"
commit-check; it passes only if the staged diff matches the latest reviewer evidence.
This repository is a template for deterministic AI-assisted development.
It provides a simple control layer so that:
- Context lives in the repo, not only in chat
- Commits require verified evidence
- Routing is deterministic
- AI is advisory, not authoritative
The goal is to make AI-assisted development stable across many sessions.
Instead of relying on ephemeral chat context, the repository stores:
state
tasks
decisions
verification evidence
The result is a workflow where:
repo = source of truth
AI = advisory
human = execution
AI-assisted development often fails because:
- context disappears between sessions
- commits happen without verification
- AI reasoning and repo state drift apart
This template solves that by enforcing a simple invariant:
reviewed patch == committed patch
A commit is only allowed if the exact staged diff has been verified by the reviewer.
The system has four layers.
The directory:
workflow/
contains the persistent project memory.
Files:
workflow/
STATE.md
TASK_QUEUE.md
SESSION_HEADER.md
DECISIONS_LOG.md
DECISION.md
EVIDENCE.jsonl
High-level project state:
project
milestone
current task
risks
STABLE_REF
Task management:
ACTIVE
NEXT
DONE
Session metadata:
RUN_ID
session rules
current task
invariants
Chronological architecture decisions.
Locked system contracts.
Example:
commit-binding
reviewer contract
router ABI
Append-only verification log.
Each entry records:
git.branch
git.head
git.dirty
git.diff_stat
git.diff_sha256
commands[]
exit_code
Located in:
scripts/
Runs verification commands and records evidence.
Example:
python scripts/wf.py reviewer --cmd "pytest" --cmd "ruff check"Actions:
- Reads staged diff
git diff --cached
-
Executes commands
-
Writes verification record to:
workflow/EVIDENCE.jsonl
Determines the next step without using an LLM.
python scripts/wf.py routeOutput:
{
"target": "cursor | gpt | new_chat",
"mode": "plan | debug | review | resume | commit",
"reason": [...],
"prompt": "..."
}Router only reads:
workflow files
staged diff
git state
This keeps routing deterministic.
Verifies commit conditions.
python scripts/wf.py commit-checkRules:
Commit is allowed only if:
latest evidence exists
git.dirty == true
diff_sha256 matches staged diff
all commands exit_code == 0
The repository includes a pre-commit hook:
.githooks/pre-commit
It runs:
wf commit-check
This blocks commits unless evidence matches the staged diff.
The development loop is:
edit
↓
git add
↓
wf reviewer
↓
wf route
↓
Cursor / GPT
↓
commit-check
↓
git commit
This ensures that verification always precedes commits.
- workflow/EVIDENCE.jsonl — One JSON object per reviewer run: git snapshot (branch, head, dirty, diff_stat, diff_sha256 when dirty) and commands (cmd, exit_code, optional stdout_tail). Commit-check compares the last valid entry to the current staged diff. This file is generated locally (not committed); see workflow/EVIDENCE.example.jsonl for schema and format.
Clone the template:
git clone <repo> my-project
cd my-projectUX wrapper (read-only; does not change workflow logic):
- scripts/conductor.py — Runs
wf route, parses the JSON, and prints a copy/paste-ready instruction block (WF NEXT or prompt). Packet goes to stdout. Optional--advice localruns a local LLM sidecar after rendering; advice is printed to stderr (soconductor.py --advice local > packet.txtkeeps the packet clean). Optional--model <name>forwards to the sidecar (e.g.llama3.1:8b). Example:python scripts/conductor.pyorpython scripts/conductor.py --advice local --model llama3.1:8b. - scripts/sidecar_llm.py — Advice-only local LLM: reads STATE, TASK_QUEUE, staged diff (and optional route JSON), calls Ollama, prints or writes advice. Outside the truth chain: does not affect reviewer or commit-check. Optional
--write-advicewrites toworkflow/ADVICE.md(that file is in .gitignore). Used by conductor when--advice localis set. - wf-next.cmd / wf-next.sh — Convenience launchers: run
python scripts/conductor.pyfrom repo root (Windows and POSIX).
Commit gate:
python scripts/install-hooks.pySet a session ID in:
workflow/SESSION_HEADER.md
Example:
RUN_ID: dev-session-1
Make a change and stage it:
git add .Run reviewer:
python scripts/wf.py reviewer --cmd "python -m py_compile scripts/wf.py"Commit:
git commit -m "example change"This demonstrates the core invariant:
reviewed patch == committed patch
If the staged diff changes after reviewer, the commit is blocked.
# install hooks
python scripts/install-hooks.py
# make a change
echo "# demo" >> workflow/STATE.md
git add workflow/STATE.md
# record evidence
python scripts/wf.py reviewer --run-id demo --cmd "true"
# change file again AFTER reviewer
echo "# change again" >> workflow/STATE.md
git add workflow/STATE.md
# attempt commit
git commit -m "demo"
# commit will be blocked because staged diff changed
# run reviewer again
python scripts/wf.py reviewer --run-id demo --cmd "true"
# commit now succeeds
git commit -m "demo"This demonstrates how the system prevents commits of unverified changes.
All context lives in the repository:
state
tasks
decisions
evidence
No hidden chat context.
Router and commit gate are pure functions of:
workflow files
staged diff
git state
No LLM calls occur inside enforcement logic.
Verification evidence includes:
git snapshot
diff hash
command results
This ensures:
reviewed patch == committed patch
AI can:
suggest
analyze
review
But cannot bypass verification.
The developer:
runs reviewer
runs router
approves commit
The system enforces correctness.
.
├── workflow/ # State, evidence, session helpers
├── scripts/ # wf.py, conductor.py, sidecar_llm.py, bootstrap.py, install-hooks.py
├── .githooks/ # pre-commit (calls wf commit-check)
├── artifacts/
├── src/
├── README.md
└── LICENSE
This project is not primarily an AI system.
It is developer tooling for safe AI-assisted development.
Specifically:
deterministic control layer
for AI coding workflows
MIT