Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 18 additions & 9 deletions docs/AUTONOMOUS-LOOP.md
Original file line number Diff line number Diff line change
Expand Up @@ -252,17 +252,26 @@ exception.
human maintainer, round 44 — see step 1). Immediately
before stopping, in this exact order:

1. **Append a row to `docs/hygiene-history/loop-tick-history.md`.**
1. **Write a per-tick shard file at
`docs/hygiene-history/ticks/YYYY/MM/DD/HHMMZ.md`** (per task
Copy link

Copilot AI Apr 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Step 1 hard-codes the shard filename shape as HHMMZ.md, but docs/hygiene-history/ticks/README.md allows HHMMZ-01.md, HHMMZ-02.md, etc. for the rare “two ticks in one minute” collision case. To prevent accidental overwrites, it would be better to document the full pattern here as HHMMZ[-NN].md (or explicitly mention the disambiguation suffix).

Suggested change
`docs/hygiene-history/ticks/YYYY/MM/DD/HHMMZ.md`** (per task
`docs/hygiene-history/ticks/YYYY/MM/DD/HHMMZ[-NN].md`** (per task

Copilot uses AI. Check for mistakes.
#276 Option B — adopted 2026-04-29 to eliminate the EOF
Comment on lines +255 to +257
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Specify collision-safe shard names in step 5

Step 5 now prescribes a single filename pattern (.../HHMMZ.md) but does not include the same-minute disambiguation rule, so two ticks fired within one minute (e.g., concurrent sessions or manual reruns) can target the same file and overwrite prior liveness evidence. That reintroduces a data-loss path in the exact area this change is meant to harden; the instruction here should explicitly include the -01, -02 suffix behavior already described elsewhere.

Useful? React with 👍 / 👎.

append-hotspot conflict surface that arose with the legacy
single-table file). The legacy table at
`docs/hygiene-history/loop-tick-history.md` remains the
canonical READ surface for pre-shard ticks; the shard
directory under `docs/hygiene-history/ticks/` is the
canonical WRITE surface for new ticks. Schema (one row per
shard, same columns as the legacy table) and rationale are
in `docs/hygiene-history/ticks/README.md`. Every tick gets
a shard — a no-op speculative-scan tick still gets a
shard (minimal-density), because the log is the factory's
durable answer to *"is the tick actually running?"* (the
commit log undercounts; chat messages evaporate). Write
the shard BEFORE the `CronList` call so even an
abnormally-stopped tick still leaves evidence it ran.
Comment on lines +259 to +271
Copy link

Copilot AI Apr 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This step switches tick-history writes to shard files, but later in the same numbered list the text still instructs to “append a correction row to the history log” (legacy behavior). Please update the remaining step-5 bullets to be shard-consistent so readers don’t revert to editing docs/hygiene-history/loop-tick-history.md directly for post-2026-04-29 ticks.

Copilot uses AI. Check for mistakes.
Human maintainer, round 44: *"you might as well right a
history record somewhere on every loop tool right before
you check cron"*. The schema and rationale are in the
header of that
file. Every tick gets a row — a no-op speculative-scan
tick still gets a row, because the log is the factory's
durable answer to *"is the tick actually running?"* (the
commit log undercounts; chat messages evaporate). Append
BEFORE the `CronList` call so even an abnormally-stopped
tick still leaves evidence it ran.
you check cron"*.
2. **Call `CronList`.**
3. **If `<<autonomous-loop>>` is present at cadence
`* * * * *`:** do nothing to the scheduler — the cron
Expand Down
119 changes: 119 additions & 0 deletions docs/hygiene-history/ticks/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
# Tick-history shard files

This directory holds **per-tick shard files** for autonomous-loop
liveness evidence. One shard per autonomous-loop tick.

## Why shards exist

The single end-of-file table at
`docs/hygiene-history/loop-tick-history.md` produced an "Append-
Hotspot Merge Friction" failure mode (named by the deep-research
external-AI reviewer 2026-04-29): every tick-history PR added a
row to the same EOF surface, and parallel in-flight PRs
conflicted with each other, generating recursive maintenance work.

Per task #276 architectural choice (per-tick shard files —
"Option B"), each tick now writes a unique shard file at:

```
docs/hygiene-history/ticks/YYYY/MM/DD/HHMMZ.md
```

Per-tick uniqueness eliminates the conflict surface entirely.

## Shard file schema

Each shard is a single-row Markdown file. Required first line:

```
| <ISO 8601 UTC timestamp> | <model id> | <cron sentinel> | <body> | <PR ref> | <observation> |
```

Same column structure as the legacy single-table format. A
generator script (follow-up work) collates shards into the
legacy table on cadence; until that lands, the legacy table is
the authoritative read surface and shards are the authoritative
write surface — both are canonical.

## Naming

```
docs/hygiene-history/ticks/2026/04/29/0210Z.md
docs/hygiene-history/ticks/2026/04/29/0215Z.md
docs/hygiene-history/ticks/2026/04/30/0900Z.md
```

- Year / month / day are zero-padded numeric folders.
- Filename is HHMMZ (zero-padded hour + minute, UTC, with `Z`
suffix).
- Extension `.md` so each shard is independently grep-able and
rendered by the docs viewer.

If a tick lands within the same minute as a prior tick (rare —
the autonomous-loop cron is `* * * * *`), append `-01`, `-02`,
... to disambiguate: `0215Z-01.md`, `0215Z-02.md`.

## What goes in a shard

The same content that previously appended as a row to the legacy
table:

- Material state-transition ticks → rich shard (multiple
paragraphs covering the transitions + observations)
- Pure-maintenance / no-op ticks → minimal shard (one or two
sentences)

Per the corrected liveness doctrine (see
`docs/AGENT-BEST-PRACTICES.md` operational standing rules
section "Session-closure rule"): every tick gets a shard.
Density depends on whether material state changes happened.

## Composition with the legacy table

For the gap before the generator script lands, the legacy table
at `docs/hygiene-history/loop-tick-history.md` remains the
canonical READ surface for past history, and new shards in this
directory become the canonical WRITE surface for new ticks.

Future generator behavior:

```text
Generator (cadence: post-merge or daily):
1. Read all shards under docs/hygiene-history/ticks/**/*.md
2. Sort by filename (chronological by file naming)
3. Format as legacy-table rows
4. Append to docs/hygiene-history/loop-tick-history.md
5. Optionally retire shards older than N days to a compressed archive
```

The generator is follow-up work tracked under task #276.

## Why per-tick rather than per-day or per-PR

- **Per-tick**: each tick writes one file; no collision; no
generator pressure beyond mere collation; smallest write unit.
- Per-day or per-PR would re-introduce append-hotspot inside the
bucket. Per-tick removes the hotspot at the file granularity.

The choice was made 2026-04-29 per the converged stance from
the multi-AI synthesis arc + Aaron's explicit delegation
(*"this falls under your call"*).

## What this directory does NOT do

- Does NOT replace the legacy table for past history (that
remains the canonical READ surface for pre-shard ticks).
- Does NOT change the AUTONOMOUS-LOOP.md liveness invariant —
every tick still gets canonical evidence.
- Does NOT remove the markdownlint / chronological-order checks
— those still apply at the shard-file level.
Comment on lines +108 to +109
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Correct shard-check coverage claim

The README states chronological-order checks still apply at shard-file level, but the current gate runs tools/hygiene/check-tick-history-order.sh with no path override (.github/workflows/gate.yml), and that script defaults to docs/hygiene-history/loop-tick-history.md, so new shard files are not validated by that check. This misstates enforcement and can hide regressions in the new write surface until a generator step is added.

Useful? React with 👍 / 👎.

Comment on lines +108 to +109
Copy link

Copilot AI Apr 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The README claims that the existing chronological-order check still applies at the shard-file level, but the current CI job runs tools/hygiene/check-tick-history-order.sh with no arguments and only validates docs/hygiene-history/loop-tick-history.md. Either adjust the wording to match reality, or extend CI/scripts to also validate shard timestamps/order (e.g., iterate over docs/hygiene-history/ticks/**/*.md and check each shard’s first-row timestamp).

Suggested change
- Does NOT remove the markdownlint / chronological-order checks
— those still apply at the shard-file level.
- Does NOT remove validation: markdownlint still applies to
shard files, and chronological-order checking still applies
to `docs/hygiene-history/loop-tick-history.md`.

Copilot uses AI. Check for mistakes.
- Does NOT introduce a new tick-history schema — same column
structure as the legacy table, one row per shard.

## Migration of historical content

The legacy table at `docs/hygiene-history/loop-tick-history.md`
is NOT migrated to shard files. Pre-2026-04-29-shard ticks stay
in the legacy table. Post-shard ticks go in shards. The
generator (follow-up) collates shards into the legacy table to
preserve the single-table read experience.
Loading