DEV Community

Cover image for How I keep AI coding agents reviewable on an open-source library
Sebastian Musiał
Sebastian Musiał

Posted on Edited on AI-assisted

How I keep AI coding agents reviewable on an open-source library

Automating guardrails for high-velocity AI commits

askdare's first commit is dated 29 October 2026, and 0.8.0 came out on 2 December. In those five weeks it got eight minor releases, seven npm packages, 40 Architecture Decision Records and about 1,120 commits. About 740 of those commits carry a Co-Authored-By: Claude trailer. One person maintains it. askdare is an MIT-licensed Next.js library that puts an AI chatbot on any website with one script tag, on the OpenAI Responses API (live demo). This post is about the setup that keeps that much agent work reviewable.

Why agent output needs guard rails

A coding agent writes code faster than a person reads it. In my experience three things go wrong first. The agent works from what it remembers, and the API it remembers changed last month. It re-decides questions that were settled two weeks ago. And two agents running side by side edit the same file.

What helped was plain files in the repository that every session reads, and checks that fail when a rule is broken. None of it is specific to askdare.

Rules in CLAUDE.md, and the same rules as checks

CLAUDE.md at the root is the project's instructions for Claude Code. It has a section called "Non-negotiable rules". A few of them:

## Non-negotiable rules

- **OpenAI:**
  - Only `packages/askdare/src/openai/` may import `openai`.
  - Published `.d.ts` must contain no `openai` or `next` types.
  - Never hardcode model IDs in the library.
- **Security** ([ADR-0004](docs/adr/0004-threat-model.md)):
  - The client never chooses the model, instructions, tools, vector stores, raw `file_id`s or conversation IDs.
  - No cookies.
  - No message content or PII in logs.
Enter fullscreen mode Exit fullscreen mode

A rule in Markdown is a request. The rules I care most about are also enforced. Biome's import restrictions fail lint with "Only packages/askdare/src/openai/ may import openai (ADR-0002)", and a script fails the package check when a published .d.ts imports openai or next. The workflow rules are in the same file: work on a branch, commit locally, and never push, create a remote repository or publish to npm without my explicit approval.

Decisions go in ADRs

askdare had 40 ADRs at 0.8.0. The adr skill tells the agent when to write one: a change to the public API, where data lives, the threat model, packaging or a core dependency. We try not to rewrite an accepted ADR. When a decision changes, a new ADR supersedes it and says why, and git history shows any smaller edits.

This matters more with agents than with people. CLAUDE.md says to read the relevant ADR before changing anything it covers, so an agent that wants to tidy up an odd-looking constraint finds the reason first. When evidence is missing, a throwaway spike ends with a FINDINGS.md and a go or no-go.

One task file, one branch, one pull request

The repository started with CLAUDE.md, ADRs 0001 to 0008, three vendored skills and read-only MCP servers, all committed on 29 October. On 11 November I added a roadmap and an agent-ready task template as a GitHub issue template. On 17 November tasks moved into the repository as files in tasks/. The rule from tasks/README.md:

The file is the whole brief for whoever picks it up, person or agent. If it isn't enough, improve the file rather than passing context around.

Here is the head of a real task file for 0.9:

# c1. "Searching the web…" while web search runs

- **Status:** ready (once `release/0.9` exists: the maintainer creates it when the first 0.9 code task starts)
- **Release:** 0.9
- **Lane:** Core
- **Touches hot files:** Yes: `chat/reducer.ts`, `i18n/texts.ts` and `i18n/locales/*`. First in 0.9's Core order; b1 starts after it.
- **Changes the public API or the protocol:** Yes: a new text key (API snapshot, minor changeset); ADR-0006 is listed by 0.9's z1
- **Depends on:** none
Enter fullscreen mode Exit fullscreen mode

Below that come the goal, the ADRs to read, the files to change, what not to touch, and a Definition of Done that includes "pnpm check passes". This task also says when to stop: if the new text costs more than 40 bytes in the headless React case, the agent stops and raises it, because later work needs that room.

ROADMAP.md groups tasks into lanes that can run in parallel and lists the hot files that only one task may change at a time. Each task runs on its own branch in its own worktree, its status lives in the file rather than in a chat, and the pull request that finishes it deletes the file. Up to 0.8.0, 231 pull requests were merged.

Skills: written here, or vendored and pinned

Four skills are the project's own: typescript-conventions, openai-api, release and adr. Three come from other repositories (vercel-react-best-practices, vercel-composition-patterns and tsdown), each pinned to a commit in .claude/skills/sources.json with the date it was reviewed and what was trimmed. Each starts with an overrides block, and where a skill disagrees with CLAUDE.md or an ADR, the repository wins.

The same file lists rejected skills. One was rejected because it "Requires an unpinned global install (npm i -g agent-browser@latest)". A skill steers an agent that runs with my permissions, so I review it the way I review a dependency.

Docs over memory

The openai-api skill opens with a section titled "Check the docs first: your memory is stale". Before using any OpenAI endpoint or parameter, the agent checks the openaiDeveloperDocs MCP server, because the Assistants API and Prompt objects are already shut down and models keep getting renamed. .mcp.json holds only read-only servers; anything that can write to an account stays out of the repository.

One gate: pnpm check

Every task ends with the same command. From the root and the core package's package.json:

"check": "pnpm lint && pnpm build && pnpm typecheck && pnpm test && pnpm check:packages",
"check:package": "publint --strict && attw --pack . --profile esm-only && node ../../scripts/check-dts-no-leak.mjs dist && node scripts/api-snapshot.mjs && node scripts/react-size.mjs && tsc -p tsconfig.eject.json && tsc -p types-test"
Enter fullscreen mode Exit fullscreen mode

publint and attw check the package as consumers will resolve it. The no-leak script is the .d.ts rule from CLAUDE.md. The API snapshot turns any change to the public surface into a visible diff, and react-size.mjs holds the React entry to its byte budget. Tests replay recorded, redacted OpenAI streams with MSW, so they never touch the network.

Live checks, with real money

Recorded fixtures only replay what someone recorded. So before 0.7.0 and 0.8.0, the new features ran against the real API, with a key from a dedicated OpenAI project that has a hard spend limit (Live testing).

The 0.8.0 checks ran on 1 December with gpt-6-luna and cost about 0.17 USD. They found two bugs, both fixed before the release:

  • OpenAI reported a Flex request with no capacity inside the stream, as flex_unavailable with no HTTP status, not as the 429 the guide describes. askdare eval treated it as an outage and stopped the run.
  • Once a file in a default OpenAI conversation expired, every later turn got a 404, so the conversation failed for good. Now the chat starts a new one.

Both fixes were written in agent sessions. No test with recorded fixtures could have caught either bug, because nobody had recorded those responses yet.

What I do

Every non-merge commit I made up to 0.8.0 carries the Claude trailer: 693 of the 734 non-merge commits, and the other 41 come from Dependabot and the release bot. So I type little of the code. My part is the rest:

  • Scope. 0.9's scope was "settled with the maintainer" on 2 December, as ROADMAP.md puts it.
  • Review and merge. Auto-merge is off; pull requests are merged by hand. Security-relevant work gets /security-review and /code-review first.
  • Yeses. Pushing, creating the release/0.9 branch and publishing all wait for me. npm releases can be staged, and then a maintainer approves each version with 2FA.
  • Calls on risk. I decided to ship @boldare/askdare-s3 0.1.0 without a run against AWS S3 or R2. CI covers it against MinIO, and the gap is listed in the roadmap.

What still goes wrong

The instructions go stale. As I write this, the first paragraph of CLAUDE.md still says "Status: 0.4.0 released on npm". It hasn't been updated since 21 November, four minor releases ago. ROADMAP.md is current, but every session still reads the old line.

Lessons have to land where the next session reads them. The openai-api skill records one from askdare's tool loop: on a turn's last step, with the bot's functions switched off, a model asked for a person searched the documents until it hit max_output_tokens, because nothing told it why its functions were gone. The fix was a rule appended to that step's instructions, and the skill now explains it.

And estimates drift: the 0.8.0 live run showed that askdare eval's token estimate was about half of what a case really spends. That is a patch task now.

Agents on the user's side

The same idea ships to people who use askdare. The package includes llms.txt, the docs and an askdare skill. npx @boldare/askdare init writes an AGENTS.md that sends coding agents to node_modules/@boldare/askdare/llms.txt, so they read the docs of the installed version instead of what they remember about askdare. The release checklist has a line to keep llms.txt and the skill current with every release.

Trade-offs

  • This isn't a controlled experiment. I can't say how long askdare would have taken without agents.
  • The process costs time. Every task needs a brief, every expensive decision an ADR, and a release with new OpenAI features a live run.
  • askdare itself has limits: it calls OpenAI only for now (OpenRouter is planned for 0.9), and it needs a Next.js app to host the chat.

If your site needs a chatbot, the live demo shows askdare in a minute, and the one-click deploy gives you your own copy on Vercel with your OpenAI key. askdare is MIT-licensed and made at Boldare. The setup is all in the repository: CLAUDE.md, tasks/, .claude/skills/ and the "Working with agents" section of CONTRIBUTING.md.


Sebastian Musiał (sebastianmusial.pl) builds askdare at Boldare.

Top comments (10)

Collapse
 
raju_dandigam profile image
Raju Dandigam •

The task file as the complete brief, paired with a branch and PR, gives each agent change a clear review boundary. I like that the release checks include package-consumer resolution and recorded OpenAI streams, not just unit tests. With parallel worktrees and 231 merged PRs, do you retain which docs or ADR versions each agent consulted for a task? That would make stale-API regressions easier to reconstruct after a green CI run.

Collapse
 
sebastianmusial profile image
Sebastian Musiał •

Partly :) The task file lists the ADRs to read, and it stays in git history after the PR deletes it. With ADRs we try to supersede rather than rewrite, and git history keeps each one as it was when the task ran. What we don't keep is which OpenAI docs page the agent actually checked, and when. Good call, worth adding.

If you found this useful, a ⭐ on github.com/boldare/askdare would make my day :)

Collapse
 
kamalmosadegh profile image
Kamal Mosadegh •

That last line is the gap I'd close first — "which docs page the agent actually checked, and when" is the failure your opening names: the agent works from what it remembers, and the API it remembers changed last month. With 231 merged PRs behind this setup, the check that isn't logged is the one that bites. I'd log the docs URL, the version fetched, and the timestamp in the task file, and have the review verify the cited surface against that page instead of trusting memory — same principle as your ADRs, never rewritten, only superseded, so the record shows what was true when the work ran. Consistency checks only work against a retrieved source, not against memory: SummaC (Laban et al., 2022) scores a claim against the document in front of it, and with no document there's nothing to score. In my own fact-recall checks the bar is 55 out of 55 facts surviving a 72.5% cut — and the only way to grade that honestly is against the source text, not the model's memory.

Collapse
 
lin7c profile image
xcl •

The distinction between rules in CLAUDE.md and rules enforced as checks stood out, especially the Biome import restriction that only packages/askdare/src/openai/ may import openai. That makes the guardrail survive an agent that skims instructions, which a Markdown rule alone cannot guarantee. I also found the live-check result telling: the $0.17 run on gpt-6-luna caught flex_unavailable arriving without a 429 and an expired file producing a 404, two failures recorded fixtures could not replay. Do you treat the token-estimate drift — about half the real spend at 0.8.0 — as a separate patch task, or does it feed back into how tasks are sized in ROADMAP.md? The stale 0.4.0 line in CLAUDE.md seems like the same class of problem: a version string that should be generated rather than hand-edited.

Collapse
 
sebastianmusial profile image
Sebastian Musiał •

Separate patch, already merged :D It's just the number the CLI shows before a run, nothing to do with task sizing. And fair point on the 0.4.0 line, I'm gonna delete it soon 🫡

Collapse
 
smtahosin profile image
S M Tahosin •

haha Sebastian!! 40 decision notes and the first line still says 0.4.0 lol... mine's the same, old version sitting there since november. i keep meaning to fix it and then just.. don't xD

Collapse
 
sebastianmusial profile image
Sebastian Musiał •

Haha, busted :D If you like it, a star on GitHub helps a lot github.com/boldare/askdare, thanks!

Collapse
 
smtahosin profile image
S M Tahosin •

Thanks Sebastian! 40 notes deep and still 0.4.0, I respect the commitment lol. mine's sitting on an old version since November too.. we can call it vintage and move on xD

Collapse
 
erickong profile image
eric •

"A rule in Markdown is a request" is such a good way to put it. Pairing CLAUDE.md with lint and packaging checks that actually fail the build is what stops agents from quietly drifting back to old habits two weeks later, and keeping ADRs in-repo saves you from explaining the same constraint in every fresh session.

One extra thing that helped on top of repo-local Markdown rules for me was having a different model review the diff before I read it. A single model tends to agree with its own shortcuts, whereas a second vendor catches missing edge cases pretty reliably. I work on PenEcho (github.com/penecho/penecho), an open-source local-Markdown workspace for running Claude Code and Codex on the same task thread, mostly so I don't have to copy-paste context back and forth for that review pass.

Collapse
 
heinrichneb profile image
Heinrich Neb •

Same thing happened to us with a status line. Our rule since then: when two files state the same fact, delete it from one of them instead of keeping both in sync. Syncing is the step that gets skipped, and the file every session reads is the one it believes.