Write a how-it-works document¶
Apply this procedure to the module named by the knowledge task.
Read the task/version; the coordinator runs the local delivery with scripts/heyaira-run.sh.
1. Pin the implementation and evidence¶
- Record repository, reviewed commit, module and relevant merged PR or RESULT references.
- Read changed code and tests before reading the design specification as a comparison.
- Follow imports/callers to locate entry points, actors, persistent state and emitted results.
- Read the latest relevant RESULT notes; retain their test limitations and commit references.
- Check the running revision through
server_identityonly when making deployment claims. - Label differences between reviewed code and the running revision; do not imply deployment.
Use these reads to locate the implementation and obtain line references.
git rev-parse HEAD
git show --stat <merged-commit>
rg -n '<entry-point|state|tool-name>' src tests docs
nl -ba <source-file> | sed -n '<first>,<last>p'
2. Draft a document below 250 lines¶
- Use the project's documentation language; HeyAira repository docs use English unless the task specifies Polish.
- Keep the labels
ŹródłaandRozjazdyvisible; write the body in the selected language. - State purpose in two sentences: the trigger and the observable result.
- Define actors by what they read/write on this path, not by copying role profiles.
- Describe the actual execution order, including refusals and recovery paths that exist in code.
- Prefer tables for actors, steps, state transitions, fields and branch conditions.
- Use prose only to explain a dependency or condition that the tables cannot express clearly.
- Omit proposed functionality; name missing behavior in
Rozjazdyif it matters to the comparison.
Use this outline; keep headings empty only while drafting, never at delivery.
# <Module>: how it works / Jak działa
Reviewed: <repository>@<commit>; verified: <date>; runtime: <revision|unverified>
## Purpose / Cel
## Actors / Uczestnicy
| Actor | Input | Allowed effect | Boundary |
## Path / Przebieg
| Step | Trigger/condition | Code action | State/output | Refusal |
## State and contracts / Stan i kontrakty
| State/field | Writer | Reader | Constraint |
## Checks and limits / Sprawdzenie i ograniczenia
## Rozjazdy
| ID | Document claim | Code observation | Evidence pair | Next actor |
## Źródła
- <file:line> — <claim supported>; reviewed at <commit>
3. Link every substantial claim to evidence¶
- Add repository-relative
file:linereferences to implementation and meaningful tests. - Pin the reviewed commit in the document header; regenerate line references after source movement.
- Check each reference points to the stated symbol/condition, not just an existing file.
- State actual test commands/results from receipts or your own permitted checks; identify which source supplied them.
- Separate completed, simulated, skipped and unverified behavior in the checks section.
- Use specifications as the claim side of a comparison, never as proof the feature exists.
- Do not paste handoffs, memory bodies or conversation transcripts into the document.
4. Record and route drift¶
- Compare current module docs/specs against the pinned implementation after the merged change.
- For each mismatch, record both the document location and the code/test location.
- Give each row a stable ID and observable consequence; avoid architecture recommendations as facts.
- Mark an inaccessible live/public document unverified; compare its committed publishing source instead.
- Report drift IDs and proposed repair acceptance checks to the coordinator through RESULT.
- Ask the coordinator to create follow-up tasks when the execution token cannot create tasks.
- Write
None observed in the reviewed scopeonly after the comparison; keep unreviewed areas explicit. - Update process-map/day-report references only if the frozen task includes those paths.
- Do not change module code, roles or architecture to make the description easier to write.
- Send no unsolicited owner report from a knowledge task; route findings to the coordinator.
5. Check the deliverable¶
- Run
wc -l <document>; keep the result under 250 without deleting necessary evidence. - Run
git diff --checkand inspect every changed path against the authorized documentation scope. - Check local links and at least five source claims against the pinned files.
- Run the documentation checks named by the task; keep their real output in authorized evidence.
- Return source SHA, document path, drift IDs, checks and limitations in RESULT/receipt.
Sources¶
- Knowledge boundary.
- Language and verified-state rules.
- Git and durable evidence.
- Execution capability limits.
- Handoff evidence fields; use only fields appropriate to Bridge.
- Use paired drift evidence and explicit live/device limitations as a worked reporting pattern.