# Working on pic

pic is a durable coding agent in C11. Read [the architecture notes](docs/dev/architecture.md) and
[durability](docs/dev/durability.md) before changing the journal, recovery or the seams.

## Rules

1. **No AI attribution, anywhere.** Commit messages, landing messages, tickets, comments, docs and
   the changelog carry no `Co-Authored-By` naming an AI, no "generated with", no session links or
   ids, and no other mark that a tool or model wrote the work.
2. **Land through the forge.** Every change reaches trunk as a landing on zeitforge, gated by the
   required `test` check; never push to trunk, never `zit landing accept`. See
   [landing](docs/dev/landing.md).
3. **Test before landing.** `make test-pic` runs every suite, `make test-docs` included. Tests use
   a private `HOME`; never point a test at the real `~/.pic`.
4. **Add one line to CHANGELOG.md** under today's date (UTC) with each landing, in words a user
   would use. `make` regenerates `src/changelog.inc` and `src/manual.inc`, which are not committed.
5. **Dependencies stay vendored.** Re-vendor libfossil and SQLite with `tools/vendor-libfossil.sh`
   ([vendoring](docs/dev/vendoring.md)); the binary links only libc, libm and pthread.
6. **Every capability carries a tier line.** A ticket or design note that adds one says
   `Tier: … Clock: … Record: … Default: …`, and a new file under `src/` gets a row in
   `ci/tiers.tsv` in the same change; `make test-docs` fails without it
   ([keel](docs/design/keel.md), [tiers](docs/dev/tiers.md)). The default is not core.

## Where documentation goes

README.md is the front door: what pic is, why it is durable, install, a five-minute start, links.
Do not add to it. `make test-docs` fails if it passes 90 lines or 6 KB.

| You changed                               | Write it in                                   |
|-------------------------------------------|-----------------------------------------------|
| a flag                                    | docs/reference/cli.md                         |
| a setting                                 | docs/reference/settings.md                    |
| an environment variable                   | docs/reference/env.md                         |
| a slash command                           | docs/reference/slash.md                       |
| an RPC command or event                   | docs/reference/rpc-commands.md, events.md     |
| a hook event                              | docs/reference/hook-events.md                 |
| a key action                              | nothing: regenerate docs/reference/keys.md    |
| a key default that differs from Pi's      | docs/reference/keys.md, with the reason       |
| how something behaves for a user          | its one topic in docs/manual/                 |
| a whole new feature                       | a new topic file in docs/manual/              |
| a difference from Pi                      | docs/manual/differences-from-pi.md            |
| an invariant, schema or OS seam           | docs/dev/                                     |
| a decision or proposal                    | docs/design/, with a status line              |
| a source file's tier or a tier leak       | ci/tiers.tsv, ci/tiers.allow, docs/dev/tiers.md |

`make test-docs` fails until a new flag, setting, variable, slash command, RPC command, event or
hook event has its row, and when a row names something the code no longer has. The key table is
generated from `src/tui/keymap.c`: `sh test/pic/docs.sh --keys` prints it.

1. One fact, one place. Link to it; do not restate it. `pic --help` is a synopsis (40 lines, 100
   columns), not the manual.
2. Reference files are tables. A row is a name, its type or arguments, its default, and one line.
   Explanation goes in the manual topic.
3. Manual topics are for a user. Table names, column names, source file names and iteration counts
   belong in docs/dev/.
4. Wrap prose at 100 columns. Every file in docs/manual/ and docs/reference/ is compiled into the
   binary: `pic help TOPIC` prints it as it is, and it starts with a `# Title` line.
5. A test seam (an environment variable only tests set) goes in test/pic/docs.allow with a reason,
   not in the reference.
6. Nothing under docs/archive/ is edited. Write a new file in docs/design/ and mark the old one
   superseded.
