When I started ClubHub, “using AI” meant cracking open a terminal, pasting a prompt into Codex, and hoping it changed the right files.
That… sort of worked.
But pretty quickly I wanted something more structured:
-
AI that works like a developer on the team, not a magic autocomplete.
-
Clear tasks, a backlog, and a way to avoid collisions when multiple AI workers (and humans) touch the same codebase.
-
A paper trail: what was done, why, and what’s next.
This post walks through the evolution:
-
A simple
codex.shscript to spin up AI work sessions -
A real backlog documenting work for humans and AI
-
Project rules that constrain what AI can do
-
A locking system so multiple workers can collaborate safely
Lots of examples; steal anything useful.
1. The first step: a tiny Codex wrapper
The very first thing was a shell script to create a consistent context for AI work.
Instead of manually copying prompts, I added scripts/codex.sh:
The script didn’t talk to the API directly (Cursor / ChatGPT handles that), but it gave me:
-
A single source of truth for project context
-
A way to phrase tasks consistently
-
A habit: “spin up an AI worker with a specific mission”
The system context file
prompts/system-project-context.md looked roughly like this:
This was “AI v0”: useful, but still essentially a very smart autocomplete pointed at the whole repo.
2. Adding a backlog AI can understand
Next I needed a backlog that both humans and AI could work from.
Enter docs/backlog.md.
Instead of vague TODOs, each item became a structured “story”:
This changed the AI relationship:
-
Instead of “fix whatever you see”, prompts became
“Work on item A1, here are the acceptance criteria.” -
Both of us were now staring at the same backlog.
For some stories (especially for Epic A/B) I started moving them into per-story files (docs/backlog/A.../A1-*.md), which made it easier to attach extra context and notes.
3. Teaching AI the rules of the repo
To stop AI from colouring outside the lines, I added project rules (Cursor / .cursorrules style).
Conceptually, they look like this:
Now a worker started with:
-
Shell script + system context
-
Backlog item (A1 / B5 / etc.)
-
Rules that say what’s allowed
Still missing: coordination. If three workers grabbed A1 at once, chaos.
4. Locking: treating AI as real team members
The next evolution was to assume there could be multiple workers, human and AI, and they mustn’t stomp on each other.
I added a lock to each story file’s front-matter.
Story file with lock
Example docs/backlog/A-mvp-member-subscriptions-payments/A1-membership-subscription-creation.md:
Locking rules
Plain language for humans and prompts:
-
If
lock.owneris non-empty andexpires_atis in the future → LOCKED. -
If
lock.owneris empty, orexpires_atis empty, orexpires_atis in the past → UNLOCKED (missing or stale).
When a worker takes the task, they:
When they finish:
If a lock expires, a “sweeper” (or a human) can reset it:
5. Updating the AI worker guide
To make this stick, I created an AI worker guide in docs/ai-workers/README.md:
Now every AI session can be told:
“Follow the AI Worker Guide in
docs/ai-workers/README.md.”
6. Wiring locks into the rules
Finally, I wired the locking behaviour into the project rules so workers don’t “forget”.
Conceptual .cursorrules snippet:
And a sweeper prompt for occasional cleanup:
Run that occasionally and the backlog never stays jammed with dead locks.
7. Why this feels different from “just using AI”
After this evolution, the AI stopped being “a fancy autocomplete” and started to feel like:
-
A team of junior/mid engineers with:
-
A backlog
-
Task IDs
-
Ownership and locks
-
A written working agreement
-
Key properties:
-
Repeatability: prompts and rules live in the repo, in version control.
-
Accountability: each story file shows status, lock owner, and a short history.
-
Safety: multiple workers can operate without stepping on the same story.
The tooling is simple — shell scripts, markdown, YAML — but it creates a strong frame for AI collaboration.
8. A short history of the AI system (from git)
One of the nice side-effects of keeping everything in the repo is that the
AI system itself has a clear history. You can literally see when each concept
arrived.
A simplified timeline (from git):
- **2025-11-10 – First Codex wrapper**
- Added `scripts/codex.sh` and `prompts/system-project-context.md`.
- Goal: stop copy-pasting giant prompts; give AI a stable project context.
- **2025-11-12 – Backlog as a first-class citizen**
- Introduced `docs/backlog.md` with structured items (`ID`, `Epic`, `Status`,
`Acceptance Criteria`).
- AI tasks switched from “fix this file” to “implement story A1/B5/etc.”.
- **2025-11-15 – Project rules for AI**
- Added project rules (e.g. `.cursorrules` / Cursor config).
- Defined per-area constraints:
- Backend: respect layering, add tests.
- Frontend: keep components small, test with RTL.
- Docs: don’t delete history, keep IDs stable.
- **2025-11-18 – Locking and AI Worker Guide**
- Created per-story markdown files under `docs/backlog/**`.
- Added YAML front-matter with `status`, `priority`, and a `lock` block:
- `lock.owner`, `lock.locked_at`, `lock.expires_at`.
- Wrote `docs/ai-workers/README.md` explaining how workers:
- Check locks
- Take a lock
- Release or recover stale locks
- **2025-11-20 – Sweeper and hygiene**
- Added a “sweeper” prompt in `docs/ai-workers/sweeper-prompt.md` to clear
stale locks.
- Ensured rules require AI workers to:
- Honour locks
- Update status when done
- Keep backlog and docs in sync with work.
This is the bit I find most interesting: the AI system itself is just another
feature, evolving through small commits:
- Tiny script → shared context
- Shared context → backlog the AI can read
- Backlog → rules
- Rules → locks
- Locks → a team of humans + AI that can safely work in parallel

No comments:
Post a Comment