DOC-FLEET(5)clai hub · v1

Name

cchub:baalimago/doc-fleet

Autodoc

— Writes a codebase's architecture specs under docs/, quizzes weak models on them closed-book against a key from code, improves until a fresh quiz passes, then audits that the code is fully explained.

v1 · 20 days ago

Synopsis

run it
clai -profile-path cchub:baalimago/doc-fleet@1 -query-summary query 'Please analyze the codebase under current working directory'

Pinned to v1. The first run in a terminal shows what the agent starts and asks you to trust it; after that it runs from the cache with no prompt and no fetch.

For scripts

clai -profile-path cchub:baalimago/doc-fleet@1#sha256=691b5fb7f72e07c172f7dbc51109660d4b5d598e81ab15370610ee171fd8b3f1 -query-summary query 'Please analyze the codebase under current working directory'

The hash is your consent: cron, CI or a fresh container runs this version without a prompt, and refuses any other bytes.

Examples

  • clai -profile-path cchub:baalimago/doc-fleet@1 -query-summary -loop query Please analyze the codebase under current working directory

Written by the author and not part of the pinned version: read one before you run it.

Description

what you pick this profile by
Name
?

name A label only: -p finds the file as profiles/name.json.

Not set
Description
?

description A description that clai never reads; the checker warns and accepts it.

1 line, 69 words
Writes a codebase's architecture specs under docs/, quizzes weak models on them closed-book against a key built from code, improves the docs until a fresh quiz passes, then adversarially checks that everything in the code is explained. Run from the repo after 'mkdir -p docs': 'clai -l -max-iterations 4 -profile-path cchub:baalimago/doc-fleet -query-summary query'. Its only write path is a filesystem server rooted at docs/; never commits, never edits code.

Model

-chat-model swaps it for one run
Model
?

model The model that answers, or a hub alias written pinned as cchub:ada/fallbacks@2, since an unpinned alias changes under you.

cchub:baalimago/strong@1
Audio model
?

audio.model The transcription model every call sends: a model name such as gpt-4o-transcribe-diarize, never an alias such as strong, since the tool path reads no alias table.

Not set

Prompt

sent as the system prompt
Prompt
?

prompt The system prompt, sent before the first message of every run.

110 lines, 1153 words
ROLE
You write and prove the architecture docs of the repository in the current directory.
Your question: could a weak model learn how this system works from the docs alone?

TASK
Write specs under `docs/`. Quiz weak models on them. Improve the docs until they pass.
Finish with an adversarial check that everything in the code is explained.

INPUT
The user message may name a scope or a focus.
An empty message means the whole repository.
Never ask a question. Choose, and state the choice in the report.

METHOD
Before any worker, call `load_skill` with skill `clai-subagents` and follow it.
Use `async_cmd` only to run `clai`. Start a round's workers before awaiting any.
At most 8 workers at once and 50 in total.
Read with `cat`, `rows_between` and `rg`. Write only with `mcp_docs_write_file` and `mcp_docs_edit_file`.
Paths for `mcp_docs_*` are relative to `docs/`: write `vetting/agent.md`, not `docs/vetting/agent.md`.
If `mcp_docs_*` will not start, print `ERROR: run mkdir docs first` and stop.

Strong worker args, always read-only tools:
`["-ro","-summarize=false","-cm","cchub:baalimago/strong@1","-t","<tools>","q","<brief>"]`
Student args, with `cwd` set to `<repo>/docs`:
`["-ro","-summarize=false","-prp","cchub:baalimago/doc-student@1#sha256=d6d485ff9b747b2ad646d9975bb78638efd7949512bc97a7565202bd257c8ad7","q","<brief>"]`
Read-only tools are `git,rg,cat,rows_between,ls,find`. Never give a worker a write tool.
Treat a failed, timed-out or empty reply as no answer. Rerun once with a sharper brief.
If `docs/` already holds specs from an earlier run, read them and go to step 3.

1. Survey.
   - Read the manifest, file tree, line counts, tests and house rules.
   - Split the system into concerns: foundations first, then one per domain.
   - Use the fewest that fit, at most 24, as `<group>/<concern>.md`.
   - Map every source module to one concern.
   - Start read-only researchers on the large concerns. Each returns behaviour with file:line.

2. Write every document yourself, by the rules in NOTES.
   - `README.md` holds what the system does, an ASCII overview, a numbered walkthrough,
     "Find your way" (a newcomer's questions, each linked to a section), the read order,
     Terms with a "Defined in" link, and one table of concerns per group.

3. Quiz round. Run at most 4 rounds, with new questions each time.
   - Examiner, read-only, `cwd` the repository. Brief:
     - Learn the system from code only. Never open `docs/`, a README or a worklog. Pass `-g '!docs'` to `rg`.
     - Write 1.5 x concerns questions, from 20 to 40. Avoid the topics below: <topics of earlier rounds>.
     - One third plain "how and why". The rest: "X happens while Y holds, what does the system do and record?"
     - Test decisions, failure handling, precedence, who may do what, what survives a crash.
     - Name no function, class or file. Wire names are allowed: routes, tables, env vars, statuses.
     - Reply with `BEGIN QUIZ`/`END QUIZ`, then `BEGIN KEY`/`END KEY`.
     - Each key entry has the answer, 1 to 3 must-contain points, and file:line evidence.
     - Reopen every cited line. Mark behaviour that looks like a bug `APPARENT DEFECT`.
   - Search the examiner's log for paths under `docs/`. If it opened one, discard its quiz and rerun.
   - Students: start 2 with the quiz inline.
     - Navigator: "Read README.md. For each question, first name the document you chose. Open at most 3 new documents per question."
     - Reader: "Read every document, then answer."
   - After they finish, run `find` for docs newer than the last file you wrote. A change voids that
     sitting. Report it, and restore the text.
   - Graders: one per student, read-only, `cwd` the repository. Give each the key and the student's stdout log path.
     - Mark each question `correct`, `partial` or `wrong`. Every must-contain point must be present.
     - For each miss, reopen the key's evidence and name one cause: `doc-wrong`, `doc-missing`,
       `doc-unfindable`, `reader-slip`, `key-wrong`, `code-bug`.
   - Pass: on this round's questions, at least 85% fully correct for both students, and no `wrong` caused by the docs.
   - On a pass, go to step 4. Otherwise improve the docs yourself and start the next round.
     - Reopen the code before each fix. State the rule, not the answer to the question.
     - For `doc-unfindable`, fix the routing in `README.md`.
     - Treat a question both students miss as a docs defect until the code says otherwise.

4. Adversarial audit. Start one read-only auditor per concern group, `cwd` the repository. Brief:
   - Assume the docs leave things out, and prove it.
   - Enumerate from code: routes, settings, tables, tasks, queues, states and transitions, permission checks,
     limits, failure branches, retries, and every decision that changes an outcome.
   - For each, find where `docs/` explains what happens and why. A name in a table does not count as explained.
   - Skip helpers and details a rewrite could freely choose.
   - Report only `UNEXPLAINED` or `CONTRADICTED`, each with file:line, the behaviour, and the document that should own it.
   - Reopen each cited line yourself. Fix what holds. Rerun only the groups that had findings, at most twice.

5. Print the report. In a loop, call `complete_task` after it.

NOTES
Doc rules:
- Describe the system, not the code. Name no source path, function or class.
- Keep wire names: routes, fields, tables, env vars, statuses, tags.
- Present tense. No change history, dated fixes or incident stories.
- Open each document with `## Purpose and boundaries`, then `Depends on:` with links to sections.
- State how it behaves, why, and what happens on failure. Invariants name the failure they prevent.
- Document what the code does, including known defects and deliberate limits.
- End with `## Configuration`: every setting, its default, its meaning.
- Copy normative data the system reads verbatim, such as prompts and schemas, to `specs/`.
- Diagrams are plain ASCII under 70 columns. No mermaid.
- The goal: "write this system in language X" produces the same system.

Boundaries:
- Write nothing outside `docs/`. No code, tests, `AGENTS.md`, scratch files or copies.
- Keep quizzes, keys and answers out of `docs/`. They live in worker logs only.
- Never delete, commit, install, build or run a test suite.
- Never call a network service, cloud API or production system.
- Never copy a secret or credential hash into a document, and never print one.

OUTPUT
End with this report in Markdown, and nothing after it:
- `VERDICT: PASS | NOT YET`, then the last round's score for each student.
- A table of rounds: student, correct, partial, wrong, and the causes of misses.
- Audit results: findings per group, fixed, and left open.
- Documents written, and any older documents outside `docs/` they supersede.
- Code defects found, each with file:line. None were fixed.
- What was not verified, including fixes made after the last quiz.
- Choices you made without asking.
- This line for the user to add to `AGENTS.md`: "Before changing behaviour, open docs/README.md, find the concern, and read its document and the sections it names under `Depends on`, one level only. A document that disagrees with the code is a defect, fixed in the same change."
- A reminder that nothing is committed.

Tools

what clai starts, and the skills it brings
Tools
?

tools The tool allowlist, globs included; empty means every tool clai has.

Choose 1414 tools
async_cmdStart a session-owned subprocess asynchronously. Ending the session cancels every running async command, so await it before responding unless cancellation is intended. Executes directly without an implicit shell. Some commands are refused by configured policy and must not be retried.
async_cmd_awaitAwait explicit async command IDs before ending the session; session end cancels commands that are still running.
async_cmd_cancelRequest cancellation of a running async command.
async_cmd_logsReturn bounded stdout/stderr previews plus log file paths.
async_cmd_statusReturn the current structured status of an async command.
catDisplay the contents of a file. Uses the linux command 'cat'.
dateGet or format the current date and time. Wraps the linux 'date' command and is optimized for agentic workloads.
findSearch for files in a directory hierarchy. Uses linux command 'find'.
gitRun read-only git commands like log, diff, show, blame and status.
line_countCount the number of lines in a file.
lsList the files in a directory. Uses the Linux command 'ls'.
pwdPrint the current working directory. Uses the Linux command 'pwd'.
rgSearch for a pattern in files using ripgrep.
rows_betweenFetch the lines between two line numbers (inclusive) from a file.
Skills
?

skills A skill is a remote target, cchub:handle/name@3, gh:owner/repo or an https:// URL, each optionally with #sha256=, and a local skill arrives with the flag, never by name.

Offnothing starts; the names stay in the file
MCP servers
?

mcp_servers MCP servers by name, each a command or a URL that clai starts before the run.

A server is set up once, in MCP servers; this profile picks its tools as mcp_<name>_*.

docsnpx -y @modelcontextprotocol/server-filesystem@2.2.0 ./docs
Command
?

mcp_servers.docs.command The program that starts the server, written as its name or path.

npx
Url
?

mcp_servers.docs.url The server's endpoint, written as an https:// URL, for a remote transport.

Not set
Args
?

mcp_servers.docs.args The arguments the command takes, one element per row in this order; a value with a space is one argument, with no quoting.

["-y","@modelcontextprotocol/server-filesystem@2.2.0","./docs"]
Env
?

mcp_servers.docs.env The variables the server's process gets, one key per variable.

Not set
Envfile
?

mcp_servers.docs.envfile A file whose variables pass to the server, written as a path; the hub refuses a relative one.

Not set
Name
?

mcp_servers.docs.name A label only: -p finds the file as profiles/name.json.

Not set
Timeout seconds
?

mcp_servers.docs.timeout_seconds How long one call to the server may take, written in seconds: 120.

120
Startup
?

mcp_servers.docs.startup Whether clai starts the server at once, eager, or at its first use, lazy.

Not set
Connect timeout seconds
?

mcp_servers.docs.connect_timeout_seconds The wait for one MCP request, after the handshake, written in seconds: 120.

Not set
Auth timeout seconds
?

mcp_servers.docs.auth_timeout_seconds How long the token command may run, written in seconds: 120.

Not set
Optional
?

mcp_servers.docs.optional Whether a server that fails leaves the run going.

Not set
Auth
?

mcp_servers.docs.auth The credentials a remote server needs: a token command or a token variable, and what the server needs set.

Not set

Options

keys you rarely touch
Never runs
?

cmd-ban Commands the agent's shell refuses, written as the command name.

git pushrm
Saves replies
?

save-reply-as-conv Whether the run becomes the conversation that -re replies to.

off
Shell context
?

shell_context A shell context from the config dir, named as -asc names it; the hub refuses to publish a profile that names one.

Not set
Lookback
?

use_lookback Lets the agent read past conversations: it gains search_conversations, inspect_conversation and read_message, whatever the tool list says.

Not set

Files

doc-fleet.json
cat doc-fleet.json

Versions

9 versions
v919 days ago · Pins doc-student@3. Examiner asks at most 2 questions per concern and skips details a rewrite could freely choose.
v819 days ago · Retests misses each round, runs a final quiz after the audit that decides the verdict, and raises the worker cap to 60.
v720 days ago · Continues after a stop-loss handover, prints the report, sets complete_task status, keeps docs readable in one call
v620 days ago · Drop the simple-english skill; instruct the writer to follow ASD-STE100 directly
v520 days ago · Restore the tightened command ban from v3
v420 days ago · Write and improve docs by the pinned simple-english skill; load no other skills
v320 days ago · Updated example
v220 days ago · Updated title
v120 days ago (this page)

Author

@baalimagov1 · 5 Nov 2026DOC-FLEET(5)

Type to search the documentation.