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
5 changes: 5 additions & 0 deletions .changeset/media-undo-recount.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@schlessera/brain-ui-server": patch
---

Undoing a media effect from hygiene review now updates the review's media count when another card is pending or the pass has ended. Before, the count kept the undone effect until the next selection, so it disagreed with `brain sync`.
5 changes: 5 additions & 0 deletions .changeset/sync-skill-media-review.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@schlessera/brain": patch
---

The `/sync` skill no longer asks about media files or lists them. It leaves media untouched, repeats the report's `Media awaiting review: N` line, and points to hygiene review's five actions.
16 changes: 13 additions & 3 deletions docs/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ when its artifact is null.
| `audit` ⚖ | Staleness/propagation/index-lag/orphan/type-mismatch/marker/broken-link/repeated-text/duplicate-title audit | `{issues, errors, warnings, infos, mustFix, informational}`; module hygiene checks appended. TODO and VERIFY markers are one `info` finding per document and kind, with `count` and the first three as `examples`; `verification: unverified` in the frontmatter is one `verify` finding on its own. An unresolved wiki-link is a `broken-link` warning, resolved exactly as `validate` resolves it. `mustFix` is errors plus warnings, `informational` is infos. `--fix --json` returns `AuditFixResult[]`: deterministic suggestions with `canAutoFix` and optional `repair: { capability: "registry", path }` for an available registry repair only. It calls no provider, emits no replacement `fix`, applies nothing and grants no execution permission |
| `accept-mtime` | Baseline file mtimes so silent-edit detection stops flagging mechanical edits | |
| `tags` ⚖ | Tag hygiene report: variant groups with a proposed canonical tag, tags that repeat the document's type or directory, alias hits, out-of-vocabulary tags | read-only; reads frontmatter, not the index; configure with [`taxonomy.tags`](configuration.md#taxonomytags). `--apply` migrates the tags: every `aliases` entry and every variant group whose canonical is in `vocabulary` (`--groups`: all of them; `--redundant`: also drop redundant tags; `--only <old>`: one tag; `--dry-run`: report only). It edits only the `tags:` entries on the raw text, never bumps `updated`, reindexes, and accepts the touched files' mtimes. A file edited while it runs is skipped, and `--only` merges only the collisions its own rename causes |
| `hygiene reconcile\|list\|next\|dismiss\|snooze\|resolve\|undo\|check` ⚖ | The content-hygiene log under `context/hygiene/`: `reconcile` refreshes the index, detects issues (audit checks, `brain validate`'s corpus checks, silent edits, index table rows, `--extra` candidates), joins reports of one problem into one finding with a stable ID, its sources and an evidence fingerprint, applies the open/snoozed/dismissed/resolved state machine and writes only the files that change; `list` reads the log; `next` reconciles and selects one open finding by severity, explicit urgency, age and ID with a structured priority reason and end-state counts (informational findings are counted but not shown); `dismiss` and `snooze` record a disposition that holds until its evidence fingerprint changes (or, for a snooze, it comes due). Wiki-link rows use indexed targets, including aliases and configured directory anchors; ambiguous/unresolved rows are skipped | `reconcile --fixed <file>` records the skill's auto-fixes in `last-run.md`; `reconcile --dry-run` writes no log file (the index is still refreshed); `list --state open\|snoozed\|dismissed\|resolved`; `dismiss <id> --expect-fingerprint <fp> [--reason <text>]`; `snooze <id> --until <date\|date-time> --expect-fingerprint <fp>`. A stale fingerprint is refused with exit `1` and nothing written; `brain validate` still reports what is dismissed. Sections of the log it does not own are kept as written, each file is replaced atomically, and while a check cannot run (a module's check throws, fact-drift cannot read a canonical file) nothing that was not detected again is resolved. `next --finding <id> --dry-run --json` reads the current detected open finding by ID without writing Markdown; counts retain the existing log state. `next --json` exits `1` with a structured configuration blocker before any indexing or log writes when the config is invalid. See [selection mappings](integration-contract/package-api.md#hygiene-selection-additive-1026). The `content-hygiene` skill orchestrates reconciliation |
| `hygiene reconcile\|list\|next\|dismiss\|snooze\|resolve\|undo\|check` ⚖ | The content-hygiene log under `context/hygiene/`: `reconcile` refreshes the index, detects issues (audit checks, `brain validate`'s corpus checks, silent edits, index table rows, `--extra` candidates), joins reports of one problem into one finding with a stable ID, its sources and an evidence fingerprint, applies the open/snoozed/dismissed/resolved state machine and writes only the files that change; `list` reads the log; `next` reconciles and selects one open finding by severity, explicit urgency, age and ID with a structured priority reason and end-state counts (informational findings are counted but not shown); `dismiss` and `snooze` record a disposition that holds until its evidence fingerprint changes (or, for a snooze, it comes due). Wiki-link rows use indexed targets, including aliases and configured directory anchors; ambiguous/unresolved rows are skipped | `reconcile --fixed <file>` records the skill's auto-fixes in `last-run.md`; `reconcile --dry-run` writes no log file (the index is still refreshed); `list --state open\|snoozed\|dismissed\|resolved\|kept`; `dismiss <id> --expect-fingerprint <fp> [--reason <text>]`; `snooze <id> --until <date\|date-time> --expect-fingerprint <fp>`. A stale fingerprint is refused with exit `1` and nothing written; `brain validate` still reports what is dismissed. Sections of the log it does not own are kept as written, each file is replaced atomically, and while a check cannot run (a module's check throws, fact-drift cannot read a canonical file) nothing that was not detected again is resolved. `next --finding <id> --dry-run --json` reads the current detected open finding by ID without writing Markdown; counts retain the existing log state. `next --json` exits `1` with a structured configuration blocker before any indexing or log writes when the config is invalid. Since 0.45.0, `next --defer <id>=<fp>,…` skips findings left pending this pass, and `media <delete\|move\|persist\|keep-copy>`, `keep-copy` and `unkeep` are the media review effects hygiene review drives ([contract](integration-contract/cli.md)). See [selection mappings](integration-contract/package-api.md#hygiene-selection-additive-1026). The `content-hygiene` skill orchestrates reconciliation |
| `registry` ⚖ | Regenerate the registry table of every `_index.md` with a `registry:` frontmatter block, from its children's frontmatter, between `<!-- brain:generated:registry -->` markers | `--check` writes nothing and lists stale indexes (exit 1), and is the only form that runs in an uninitialized directory; an index or child that cannot be read or parsed is reported under `invalid` and left as it is; `updated` is bumped only on a file whose table changed; `{indexes, written, stale, invalid}` |
| `maintain` | Routine maintenance sequence: registry tables (as `brain registry`), incremental index, vector compaction (only when fewer than half the vector slots are live), audit snapshot (the same counts as `brain audit`, module hygiene checks included, with its must-fix and informational totals), stats recording (0.40.0+), tag report (counts only), git packing, scratch prune | exit 2 if any step failed (the tag report never fails it), and then stderr's last line names each failed step and the start of its result (`brain maintain: FAILED step(s): git (fatal: …)`, at most about 1,000 characters), so a scheduler that keeps only stderr's tail still records which step failed; the hosting container runs it daily. The git step runs git's non-destructive `loose-objects`, `incremental-repack` and `pack-refs` maintenance tasks when the brain is a git work tree (git's own gc counts loose objects, not bytes, so a content repo's large blobs can stay loose indefinitely); it never deletes a ref or expires a reflog; `--no-git` skips it. A brain with no chat server has no other periodic pass, so schedule it (cron) or the scratch area is pruned only when something writes into it |
| `scratch clean\|prune` | Empty the scratch area (`.brain/scratch/`), or prune unlinked files to 7 days and 1 GB, preserving retained conversation links | `{action, removed: [{path, bytes, reason}], failed: [{path, reason}], bytes, files}`; exit 2 when a file could not be removed; `prune` also reports `{pinned: {files, bytes}, overageBytes, pinError?}` and accepts `--pins-file <path>`; all prune callers honor managed pin data under `.brain/`. Missing/corrupt managed pins suspend deletion (exit 2); pinned overage is reported. `clean` explicitly removes pinned files too. `render`, `image`, `okf export` and the UI's mask tool prune after writing there, and the chat server prunes hourly |
Expand Down Expand Up @@ -232,8 +232,8 @@ preserved without checking whether the heading exists.
| `module enable\|disable <name>` | Reactivate or park a configured workflow, synchronize skills and owned instructions | preserves domain config and content; refuses legacy mixed instruction sections before writes; see [migration](modules.md#instruction-migration) |
| `config check` | Validate config, print effective taxonomy summary | |
| `config get <dotted.path>` | Read a resolved config value | lets skills query module config |
| `sync` ⚖ | `sync run`, then the `/sync` skill only for what needs judgment | In 0.40.0+, machine mode (`--json` or non-TTY stdout) emits one `{run, agent}` result; human mode prints the report and any agent answer. Hands over to a configured runner for unresolved conflicts, `UNKNOWN` leftovers, or interactive `MEDIA`/`LARGE` leftovers. Without an invocation, preserves the run's exit code (`0` complete, `1` failed, `3` needs judgment); a successful agent invocation exits `0`, an agent failure `2`. On 0.39.0, bare sync always prints text; use `sync run --json` for the mechanical envelope |
| `sync run` | The whole sync without an agent: reconcile stashes, `assess --fix`, `commit`, `pull`, `resolve`, `conclude`, `stash`, `push` (up to three re-pulls on a rejected push), `post-sync`, then a report | `status` `complete` (exit 0), `failed` (exit 1) or `needs-judgment` (exit 3: a conflict is left in progress, or a file holds conflict markers; nothing pushed). Media, unknown files and names that only look like secrets are listed as leftovers, never committed. `--json`: `{status, reason?, steps, leftovers: {unresolved, unknown, media}, judge, timings, report}`, where each `steps` key holds that verb's envelopes in run order |
| `sync` ⚖ | `sync run`, then the `/sync` skill only for what needs judgment | In 0.40.0+, machine mode (`--json` or non-TTY stdout) emits one `{run, agent}` result; human mode prints the report and any agent answer. Hands over to a configured runner for unresolved conflicts or `UNKNOWN` leftovers; media alone never starts it (in 0.45.0+, the report counts it as `Media awaiting review: N` for hygiene review). Without an invocation, preserves the run's exit code (`0` complete, `1` failed, `3` needs judgment); a successful agent invocation exits `0`, an agent failure `2`. On 0.39.0, bare sync always prints text; use `sync run --json` for the mechanical envelope |
| `sync run` | The whole sync without an agent: reconcile stashes, `assess --fix`, `commit`, `pull`, `resolve`, `conclude`, `stash`, `push` (up to three re-pulls on a rejected push), `post-sync`, then a report | `status` `complete` (exit 0), `failed` (exit 1) or `needs-judgment` (exit 3: a conflict is left in progress, or a file holds conflict markers; nothing pushed). Media, unknown files and names that only look like secrets are leftovers, never committed; the report counts media in one line and names no media file (0.45.0+). `--json`: `{status, reason?, steps, leftovers: {unresolved, unknown, media, mediaPending, mediaSetAside}, judge, timings, report}`, where each `steps` key holds that verb's envelopes in run order; `mediaPending` and `mediaSetAside` are additive in 0.45.0 ([contract](integration-contract/cli.md)) |
| `sync <verb>` | The steps on their own: `assess [--fix]`, `group`, `commit [--plan \| --plan-file <path>]`, `stash [--dry-run]`, `pull`, `resolve`, `conflicts`, `conclude`, `push`, `post-sync` | grouping is taxonomy-driven. `assess --fix` ignores artifacts and unmistakable secrets (`.env`, `.env.*`, `*.key`, `*.pem`) and holds other secret-shaped names back as `UNKNOWN`. `assess` classes a binary `MEDIA` and a file over `media.maxTrackedBytes` `LARGE`, each with its `bytes`; see [media.md](media.md). `resolve` merges each conflicted file by the strategy in [configuration.md](configuration.md#merge-strategies). `commit` leaves out, and exits 1 for, any file holding conflict markers |

Sync assessment and grouping preserve literal Git paths, including Unicode,
Expand Down Expand Up @@ -505,3 +505,13 @@ a separately confirmed Undo. Dismiss and Later are review dispositions;
shows the confirmed dispositions and deferred backlog counts. The
[review contract](integration-contract/package-api.md#human-started-hygiene-review-additive-1027)
defines the HTTP operations, durable Action state and check-only restart recovery.

Since 0.45.0, each media file `brain sync` counts as `Media awaiting review: N`
is a finding here, and the sync report never lists the files. Its card offers
*Persist here*, *Move to a final location…*, *Keep a permanent copy…* (for a
conversation-linked scratch file) and *Delete…*, each previewed before
anything is written and undoable from its receipt while the rollback data is
retained, and *Leave pending*, which skips the file for the rest of the pass
and still counts it. The review's count and the next sync's agree after each
choice and after each Undo. [media.md](media.md#what-brain-kit-does-about-it)
says what each choice leaves for the next sync.
12 changes: 12 additions & 0 deletions docs/media.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,18 @@ A brain usually hits the pain well before those limits.
scratch file whole for every request. A file too large for the files route
shows no preview at all. After a change, the receipt stays above the next
file with *Undo…* while its rollback data is retained.
- **What each choice leaves for the next sync.** *Persist here* adds an
exact `media.track` entry, so the next `brain sync` commits the file where it
is. *Move to a final location…* moves the file and rewrites the notes that
link to it, without adding a rule: the next sync commits it there when
`media.track` already covers that folder, and otherwise counts it again,
under its new path. *Keep a permanent copy…* copies a conversation-linked
scratch file to a tracked place, so the next sync commits the copy only.
*Delete…* removes the file, and *Leave pending* changes nothing. Undo puts
back every byte the change wrote; a sync that ran after it commits none of
them. Git never persists a file that `media.ignore` or `.gitignore`
ignores, or anything in the scratch area: the next sync leaves those files
out, and an original in scratch stays under ordinary scratch pruning.
- **The template's `.gitignore`** has a commented media section to start from.

## Git LFS for large masters
Expand Down
Loading
Loading