AI-assisted development¶
This page documents how AI tooling was introduced into the project, in the order it happened, with commit hashes so each statement can be checked with git show. The short version: the reference code and the written standards came first; the agent came second and was asked to follow them. The human remains the decision-maker and reviews every diff.
The premise¶
The proof-of-concept that preceded the repository was written by hand, with occasional help from a chat LLM. The first commit of this repository that matters is the baseline 16c9ce7 (2026-02-25). It already contained the full hexagonal layout (domain, application, infrastructure), a generic OAuth flow, a Spotify client, FastAPI and Typer entrypoints, 238 tests, and CI with Codecov.
Its ROADMAP.txt ended with an "AI agents" item (git show 16c9ce7:ROADMAP.txt):
Once the project is stable, try to auto-generate the agents scripts
The order is the point. A coding agent is most useful, and least damaging, on a codebase where the architecture, naming and testing rules already exist and are demonstrated by working code. Writing that base by hand first meant the agent's job was to extend a solid pattern, not to invent one.
Timeline¶
timeline
title From hand-written baseline to agent workflow
2026-02-25 : Baseline 16c9ce7 (238 tests)
: CONVENTIONS.md 03f69ef, six minutes later
2026-02-27 : AI-written docstrings eb9f876
2026-03-07 : repomix to pack code for chat LLMs 2ecbef9
2026-03-20 : CLAUDE.md 2349370 (26 lines)
2026-03-22 : Six slash commands 97df08c
: Five agents f14122f
: Arch and security fix commits follow
2026-03-24 : Dead End Protocol 0d485f2
2026-03-29 : Continue and Ollama tried then removed
2026-04-04 : Feature plans written before code 7c9b9c5
2026-05-23 : v1.0.0 and conventional commits begin
2026-06-27 : repomix removed 107aa9d
2026-07-01 : CLAUDE.md trimmed 86f57eb
2026-10-24 : Module grouping and English-only rules 7d1746b
2026-10-30 : AGENTS.md as the single source
: .claude pruned to two skills and one agent
: Layering enforced by import-linter, Ruff hook
| Step | Commit | Date | What and why |
|---|---|---|---|
| Written conventions | 03f69ef |
2026-02-25 | CONVENTIONS.md added six minutes after the baseline: layer rules, naming, logging, testing |
| AI-written docstrings | eb9f876 |
2026-02-27 | Docstrings and convention updates generated with an LLM ("Up doc with AI") |
| repomix | 2ecbef9 |
2026-03-07 | Pack the whole repository into one file to paste into a chat LLM. Removed in 107aa9d (2026-06-27) |
CLAUDE.md |
2349370 |
2026-03-20 | First Claude Code session file: 26 lines |
| Slash commands | 97df08c |
2026-03-22 | Six commands in .claude/commands/ |
| Agents | f14122f |
2026-03-22 | Five agents in .claude/agents/. The same day: c4c9495, 44f281e, 0944340 ("Fix arch review" and follow-ups); later 316a29a ("Fix security issues") and 2b107f7 ("Arch review") |
| Dead End Protocol | 0d485f2 |
2026-03-24 | A 3-attempt cap on fixing a failing test, then stop and present options A / B / C instead of looping |
| Plans before code | 7c9b9c5, 6d8c52a |
2026-04-04, 2026-05-23 | Seven taste-profile plan files (~1,100 lines) and plan_v2.md were committed as working documents. The taste-profile plans were deleted in c95d10b (2026-04-06, "plan 6 - final with cli command") and plan_v2.md at the V2 cleanup (af43b52) |
| Instruction diet | 86f57eb |
2026-07-01 | CLAUDE.md cut from 442 to 245 lines (+59 / -223 in the commit), because it is loaded into every session and costs tokens every time |
| Single source | #48 | 2026-10-30 | CLAUDE.md (260 lines) and CONVENTIONS.md (181 lines, mostly duplicates) replaced by AGENTS.md (129 lines, read natively by Claude Code and other agents) and tests/AGENTS.md (66 lines, loaded only when working on tests). The always-loaded file went from 16 KB to 8 KB |
.claude/ pruned |
#48 | 2026-10-30 | Six commands and five agents became two skills (/arch-review, /security-review) and one agent (test). The scaffolding commands were never used and had drifted (/new-migration still created revisions the project no longer adds), and the reviewer checklists copied rules that had since changed (repositories passed to use cases, before the unit of work) |
| Rules into tooling | #49 | 2026-10-30 | import-linter checks the hexagonal layering in make lint, pre-commit and CI, so the core architecture rule no longer depends on a review. A Claude Code hook runs Ruff on each edited file and feeds the errors back to the agent |
| Conventional commits and trailers | from d80bc85 |
2026-05-23 | feat: / fix: / chore: prefixes from late May; Co-Authored-By trailers on 15 commits, 12 of them in October 2026 |
Growth¶
Measured with git ls-tree / git show on each revision (Python lines under museflow/, def test_ occurrences under tests/):
| Revision | Date | Source lines | Test functions |
|---|---|---|---|
Baseline 16c9ce7 |
2026-02-25 | 3,430 | 238 |
Claude Code start 2349370 |
2026-03-20 | 5,909 | 358 |
v1.0.0 (9dcf396) |
2026-05-23 | 9,063 | 587 |
HEAD (aebe41d) |
2026-10-25 | 12,122 | 1,000 |
The project grew roughly 3.5 times in source and 4 times in tests after the agent was introduced, while the 100% branch gate stayed on. That is the claim the structure is designed to support; it is not evidence that the code is flawless.
How it works day to day¶
flowchart LR
H["Human: intent and review"] --> P["Plan for large features"]
P --> C["Claude Code session"]
CL["AGENTS.md<br/>always loaded contract"] --> C
CV["tests/AGENTS.md<br/>loaded for test work"] --> C
T["test agent<br/>fixes tests and coverage"] --> C
C --> D["Diff"]
D --> A["Review skills<br/>/arch-review, /security-review"]
A --> H
H -->|"approve or reject"| G["Commit"]
AGENTS.mdis the always-loaded contract: stack, architecture, transactions, naming, style, logging and error handling. It is short on purpose (see the diets above): rules that tooling enforces are left to the tooling, and examples are pointers to canonical files rather than code blocks that drift. Claude Code reads it natively, so there is noCLAUDE.md, and any other agent tool reads the same file.tests/AGENTS.mdholds the testing rules, loaded only when the agent works undertests/. It is the only nested instruction file, on purpose: rules scattered across many directories are hard to keep track of.- Skills are reviews on demand.
/arch-reviewand/security-reviewrun in a forked subagent, without the conversation, so the reviewer sees the diff with fresh eyes. They check it againstAGENTS.mdrather than a copy of the rules, and hold only what a review adds: known exceptions, severities, a verdict. - Agents are specialised teammates, "virtual teammates with roles" in the author's words, explicitly not people. Only
testremains: it fixes failing tests and coverage gaps autonomously, under the Dead End Protocol. - Tools check what they can. import-linter, Ruff and mypy run in
make lint, pre-commit and CI, whatever wrote the code; a Claude Code hook runs Ruff right after each edit so the agent fixes its mistakes as it goes. Reviews are left with what tools can't see. - The human decides and reviews every diff. Nothing is merged on an agent's say-so, and the 100% branch gate, Ruff, mypy and deptry run regardless of who wrote the change.
- Plan first for large features, so the review happens on a short plan before it has to happen on a large diff.
Rules added over time¶
The contract is edited as patterns that keep coming back wrong are identified. Examples, found with git log -S"<rule text>" -- CLAUDE.md (the file was CLAUDE.md until 2026-10-30):
| Rule | Commit | Date |
|---|---|---|
Never create _make_* test-data helpers; use factories |
892526e (reworded in a36adc3, 55bbeb3) |
2026-04-11 |
| Group function parameters by role; DI parameters contiguous | f5f59d5 |
2026-05-29 |
CLI output belongs in the callback, not in *_logic |
bebd543 |
2026-06-13 |
No assert in production code |
78d874a |
2026-06-27 |
| Group same-kind module members; everything written for the repo is English | 7d1746b |
2026-10-24 |
| No duplicated inner functions (centralise as a decorator) | a8ad2dc |
2026-10-25 |
Most rules are advisory to the agent and enforced by review, not by tooling, so they can drift: the assert ban dates from June, yet two assert statements had crept into production modules. It is now enforced by Ruff (S101) and none remain. Moving a rule from prose into a lint rule is the more durable fix when one is available.
Skills and agents¶
The project configures Claude Code through AGENTS.md, .claude/skills/ and .claude/agents/.
Skills¶
Invoke in a Claude Code session with /skill-name [files]; Claude may also start them on its own when their
description matches (before a PR, after a feature). Without files, they review the branch against origin/main plus
uncommitted changes.
| Skill | What it does |
|---|---|
/arch-review |
Checks the changed files against AGENTS.md: layering, transactions (no remote call inside a unit of work block), repositories, CLI output. Reports BLOCKER / WARNING / INFO and a verdict |
/security-review |
Checks the changed files for secrets, unprotected endpoints, OAuth state handling, input validation, raw SQL, unbounded Retry-After sleeps and error leakage; runs uv audit for CVEs |
Agents¶
| Agent | What it does |
|---|---|
test |
Fixes failing tests and fills coverage gaps: runs make test, traces failures, writes missing branches following tests/AGENTS.md; applies the Dead End Protocol |
Lessons¶
What worked
- Conventions first. Writing
CONVENTIONS.mdbefore any agent existed gave the agent something concrete to imitate and gave reviews something concrete to check against. - Reviewers on a separate pass.
archandsecurity(now the/arch-reviewand/security-reviewskills) drove fix commits within days of being introduced (listed above), because a reviewer with a narrow checklist catches what a generating session overlooks. - A cap on flailing. The Dead End Protocol turns "the agent is stuck in a loop" into "the agent stops and offers three options", which keeps the human in the decision.
- Plans before code, for the features large enough to need one.
- The 100% branch gate as a backstop. It makes unreviewed shortcuts visible regardless of who wrote them.
What did not
- Local-model tooling. A Continue plugin with a local Ollama
qwen2.5-codermodel was added infca41e1and removed 24 minutes later in6057540(2026-03-29); aider left only a.gitignoreentry (19682fe). Neither fit the workflow. - repomix. Useful while pasting code into a chat window, redundant once an agent could read the repository itself; removed in
107aa9d, almost four months after it was added. - Oversized always-loaded instructions.
CLAUDE.mdgrew to 442 lines and was loaded into every session. Cutting it to 245 kept the rules that change behaviour and moved detail toCONVENTIONS.mdand per-directory files. A second pass halved it again:CONVENTIONS.mdmostly repeated it, so both became oneAGENTS.md, and the testing rules moved totests/AGENTS.md. - Tooling nobody ran. Four scaffolding commands (
/new-feature,/new-provider,/new-migration,/add-tests) and two agents (python,engineer) were never part of the routine. Unused, they drifted from the code without anyone noticing; they were removed in #48. Lint fixing is left tomake lintand exploring to Claude Code's built-in agent. - Rules without enforcement. Prose rules drift (see the
assertexample above, now enforced by RuffS101). The layering rule took the same path: written in the instructions and checked by a review agent, it is now a set of import-linter contracts.