Skip to content

feat: v0.7.0 reliability overhaul (daemon, honest telemetry, health chain) - #67

Merged
mustafa-bharmal-shipveho merged 90 commits into
mainfrom
mustafa-bharmal-shipveho/audit-memory-save-retrieval
Sep 8, 2026
Merged

mustafa-bharmal-shipveho merged 90 commits into
mainfrom
mustafa-bharmal-shipveho/audit-memory-save-retrieval

Conversation

@mustafa-bharmal-shipveho

Copy link
Copy Markdown
Owner

Summary

  • Fixes the four ways the brain was silently losing memories (stranded Claude Code memory dirs, a dead remote, dead session digestion, a dream cycle that staged nothing) and the three ways retrieval lied about itself (phantom hits, timeouts, repeat injections), per the 2026-09-04 audit.
  • Adds a warm recall serve daemon that owns the embedded Qdrant store and index freshness; the Claude Code hook, the CLI and recall-mcp route through it over a 0600 unix socket. Hook wall time drops from 1.9–3.4 s to ~130 ms in QA.
  • Makes every failure visible within a day: recall health (9 checks) written hourly by sync, rendered into PENDING_REVIEW.md, and printed at SessionStart — including "sync has stopped" when no report exists.
  • Telemetry schema 1.2 (hit means docs were injected; miss/dedup/timeout/unavailable are distinct; per-doc paths; full-worker latency) and recall stats rewritten around it, with --utilization to join injections to transcripts.

Changes

Retrieval runtime (recall/, runtime/)

  • recall serve: AF_UNIX NDJSON daemon, serialized retrieval, warm-up before accept, bounded queue wait, --status/--stop/--refresh-interval-s; stdlib-only daemon_client for the hook; DAEMON_DOWN_REASONS shared by hook, CLI, MCP and the daemon's own stale-socket probe (MCP no longer falls back into a store a live daemon holds).
  • Per-session dedup store (7-day prune), relevance gate auto_recall_min_score, reranker plumbing kept off by default (calibration on 76 labelled pairs found no threshold meeting precision ≥ 0.65 with zero harmful drops; ordering experiment showed no gain at 4–13× latency), rerank pool always rerank_n deep when reranking is on.
  • Per-key layered runtime config ($RECALL_RUNTIME_CONFIG > project pyproject.toml > ~/.agent/runtime/pyproject.toml > defaults) so a project file can no longer silently disable auto-recall.
  • Deterministic exit (recall._exit.hard_exit) for the hook and the recall console script: grpcio can abort at interpreter teardown under load (3/20 imports at load 10+), which made Claude Code discard an injection already printed. recall doctor's interpreter probe trusts a stdout sentinel, not the return code.
  • Ack skip normalises punctuation and knows two-word acks.

Brain-side tools (agent/)

  • sync.sh: 50 MB staging gate with per-file hold-back, recall health in the EXIT trap with prefixed stderr and a file-freshness decision, no dependency on mktemp/tail/stat.
  • sync_claude_extras.py: mirrors ~/.claude/projects/*/memory into imports/ (mirror, never symlink), bounded incremental digests (3 sessions / 1500 s per tick, own timeout, runtime/digest_status.json).
  • Dream: LLM provider CLI fallback dirs, lint step (recall lint --fix-digests/--dedupe-claims), status file.
  • Log rotation at 20 MiB for events.log.jsonl.

Installer (install.sh, uninstall.sh, templates)

  • --setup-daemon (on by default; --no-daemon, --remove-daemon), plists rendered with plistlib, PATH with ~/.local/bin, .gitignore rules appended from a template, export BRAIN_ROOT to recursive steps.
  • Repo-local git identity when git var says the commit would fail; summary says "skipped (not found)" for absent host surfaces; BRAINSTACK_SKIP_LAUNCHCTL=1 now covers the uninstall and claude-extras launchctl calls (a sandbox uninstall used to unload the real user's agents); bin/install-recall-cli.sh regenerates a stale recall wrapper and its --quiet mode no longer dies on the first log line (which had been skipping the CLI step of every --upgrade).

Health and reporting

  • recall health → runtime/health.json → PENDING_REVIEW.md ## Health → SessionStart banner; sync-log scanners anchored on a run's own sync: lines so stray stderr cannot blind them.
  • recall stats v1.2 + --utilization; eval/ calibration scripts and RESULTS.md; docs for the daemon, runtime config, git sync, operational notes; CHANGELOG v0.7.0.

Tests

  • ~620 new tests across 40 files (hermetic suite: 2307 passed, 2 skipped, ruff clean). Daemon/client/wire-shape contracts, telemetry contract v1.2, dedup store, config precedence, health checks with fake env, sync.sh end-to-end in a binary-whitelisted sandbox, installer end-to-end in fake HOMEs (identity, summary honesty, launchctl guard), exit path, MCP daemon routing.

Testing

  • Hermetic CI command locally: BRAINSTACK_SKIP_LAUNCHCTL=1 BRAINSTACK_SKIP_CLI_INSTALL=1 pytest tests/ -q -m "not embeddings and not machine" → 2307 passed, 2 skipped.
  • Embeddings subset (test_core, test_daemon, test_cli, eval) green in isolation; two real-model daemon tests were made load-robust.
  • Smoke test (2026-09-04) and full-day simulation (2026-09-08) against a copy of the live brain: reindex 1026 docs in 2 m 45 s; 11 real hook runs at 76–142 ms; sync tick pushed with nothing > 50 MB; health/pending/SessionStart chain end-to-end; installer + uninstaller in empty HOMEs. Reports under ~/Documents/brainstack-audit-2026-09-04/reports/.
  • Reviews: staff review (CHANGES REQUESTED → fixed), staff follow-up (APPROVED WITH SUGGESTIONS; both MAJORs fixed), Codex passes 1–4 (every finding fixed, incl. pass 4's P1: existing installs kept the old recall wrapper), staff delta review of the last commits (APPROVED WITH SUGGESTIONS; all four MINORs fixed). Reports under ~/Documents/brainstack-audit-2026-09-04/reports/.

Deploy notes

  • After merge: cd ~/Documents/brainstack && git pull && ./install.sh --upgrade && ./install.sh --setup-launchd && ./install.sh --setup-claude-extras && ./install.sh --setup-daemon, then recall doctor and recall health.
  • Keep auto_recall_min_score = 0.70; leave auto_recall_min_rerank unset (reranker off).
  • The live brain remote is still blocked by a 115 MB tracked log; run ~/Documents/brainstack-audit-2026-09-04/tools/unblock_brain_remote.py (rewrites the brain repo history; needs the owner).

🤖 Generated with Claude Code

Tests written before implementation per agent-team TDD cycle; scaffold
modules raise NotImplementedError. Not for review yet.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…dowing)

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…oot helpers; archived exclude (S1)

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…escription/type (S6-2)

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…readers, dream_status.json, dream lint step (S5-B)
…LI fallback dirs (S5-C)

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Cross-encoder outputs are logits, not probabilities (jina turbo -4.3..+0.9,
MiniLM -11.4..+2.5), so the 0-1 edges put every score in one bucket and the
labels implied confidences. Edges are now (-2.5, -1.5, -0.75, 0.0) and the
histogram labels render signed ranges (<-2.5, -2.5..-1.5, ...). The renderer
keeps printing buckets it does not recognise, so a --json report written under
different edges still shows all of its counts.
…ation

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
….json

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…n-first CLI/MCP, launchd + install flags, index freshness (S3)
…me budget), separate timeout, digest_status.json

- claude_session_digest_adapter.backfill() gains limit/max_seconds:
  processes at most N pending sessions and stops cleanly (no kill)
  once the time budget elapses before starting the next session.
  Already-digested sessions never count against either budget.
  Returns processed/pending/elapsed_s/budget_hit in stats.
- digest_cli.py incremental gains --limit (default 3) / --max-seconds
  (default 1500) and prints a machine-readable
  'digests: processed=P pending=Q elapsed_s=E budget_hit=<bool>'
  summary line.
- sync_claude_extras.py gives the digest step its own timeout
  (BRAINSTACK_DIGEST_TIMEOUT_S, default 1800s) separate from the 600s
  adapter timeout, forwards BRAINSTACK_DIGEST_LIMIT /
  BRAINSTACK_DIGEST_MAX_SECONDS as --limit/--max-seconds, logs the
  summary line, and writes runtime/digest_status.json (ts, processed,
  pending, elapsed_s, budget_hit) for a future health check. Exits 0
  when the digest step completed even with pending > 0; exits 1 only
  on a real failure (non-zero rc or a genuine timeout kill).
- tests/test_digest_budget.py: adapter-level budget tests, CLI summary
  line tests, and sync_claude_extras orchestration tests (separate
  timeout, env-var pass-through, exit-code semantics, status file)
  using a fake in-process provider and a fake digest_cli.py stub
  script — no real LLM calls.
- docs/operational-notes.md: new 'Bounded incremental digests' section.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…overs; doc consistency

Item 1 - unify the "rolled siblings of this log stream" rule across all
six sites (three used a loose `<stem>*<suffix>` glob that also matched
an unrelated sibling stream sharing a stem prefix, e.g.
`AGENT_LEARNINGS_other.jsonl` / `events.log-foo.jsonl`):

- agent/memory/_atomic.py:episodic_files - now the ONE anchored
  implementation for the agent/memory/ tree (regex
  `<stem>.<YYYY-MM-DD>[.N]<suffix>`, anchored).
- agent/memory/sdk.py:_episodic_stream_files and
  agent/memory/consolidate.py:_episodic_stream - now thin wrappers
  around _atomic.episodic_files instead of keeping their own
  (already-anchored but duplicated) copies.
- runtime/core/locking.py:iter_log_paths - own copy (different deploy
  tree), same anchored rule, comment pointing at the other two.
- recall/stats.py:_log_files - own copy (different deploy tree), same
  anchored rule via new _is_rolled_sibling helper.
- recall/health.py:check_log_sizes - was globbing loosely inline
  (a sixth, previously undocumented site); now calls
  recall.stats._log_files per base stream instead.

Added a negative test per site (a same-stem-prefix sibling is NOT
picked up; a same-day counter roll IS) in tests/test_rotation_episodic.py,
tests/runtime/test_events_rotation.py, tests/recall/test_stats.py.

Item 2 - scaffold/duplication cleanup:
- grepped for "scaffold"/"once landed"/"slice [ABCD]" markers across
  recall/, runtime/, agent/, install.sh, docs/ - none found beyond
  benign unrelated uses of the words.
- removed recall/health.py:HEALTH_JSON_REL, a dead constant (every
  other reader of runtime/health.json hardcodes the literal instead).
- recall/health.py:default_brain_root() no longer keeps its own partial
  copy of the $BRAIN_ROOT/resolve_brain_home() fallback chain (which
  silently diverged from recall.config.brain_root() for the XDG
  fallback case); it now delegates to recall.config.brain_root()
  directly.

Item 3 - reviewed README.md/docs/ for the flagged stale claims
("reranker resident", "0.0 = gate off", "Fired: N turns", "ROI",
"daemon_down" outcome, "latency_ms" in the daemon protocol) - none
present; docs already match current behavior. No doc changes needed.

Verified: ruff clean; the three new/updated rotation test files plus
tests/recall/test_stats_utilization.py, tests/runtime/test_events.py,
tests/test_concurrent_appends.py, tests/test_namespaced_concurrent_appends.py,
tests/test_consolidate_acceptance.py all green; full hermetic suite
(2462 tests) run once - 2386 passed, 72 skipped, 4 failed, all four
failures pre-existing/environment-timing issues unrelated to this
change (subprocess import / daemon-warmup timeouts under heavy
concurrent-agent CPU contention in this session; 2 of the 4 pass
cleanly in isolation); `pytest tests -q -k readme` - 4 passed.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…ers once

Auto-recall fires on every substantive prompt, so both of these were paid
per keystroke-adjacent hook fire.

- `SessionDedupStore.prune` globbed and stat'd the whole shared injected/
  dir on every fire. Throttle to once an hour via a `.last_prune` marker
  mtime; `min_interval_s=0` restores the unconditional sweep. The marker is
  not a `*.json` name, so it never prunes itself, and prune still never
  creates the directory.
- `RuntimeConfig._discover_layers` parsed ./pyproject.toml to decide whether
  it carried `[tool.recall.runtime]`, then `load()` parsed the same file
  again. Discovery now returns `(path, section)` pairs and `load()` reuses
  them; `_has_runtime_section` folds into the caller.

Behaviour is unchanged in both cases apart from the documented throttle.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The SessionStart banner did the same work twice on the session-open path.

- `_health_banner_lines` read and parsed health.json twice (once with
  `max_age_hours=0`, once with the default) purely to tell "missing or
  corrupt" apart from "stale". New `recall.health.read_report(path)`
  returns `(report, stale)` off one parse; `load_report` keeps its
  existing contract for other callers, with the age test factored into a
  shared `_is_stale`.
- `_live_auto_recall_check` re-loaded `RuntimeConfig` through
  `check_auto_recall_config`, even though the hook had just loaded it for
  the same directory. Both it and `_load_runtime_config_at` now take an
  optional `config=`; the hook passes its own only when the payload cwd
  really is the process cwd (realpath compared), and any other cwd still
  takes the chdir-guarded load.
- `_brain_root` and `_health_report_path` shared one guarded
  `_brain_root_or(fallback)` lookup instead of two copies.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The dream cycle and the digest CLI both held the numbers their status
files record, then recovered them from the text they had just printed.
A rendering is a lossy copy of data; making it the source is how the log
and the receipt drift apart.

- auto_dream: `_write_cycle_status` takes the cycle's own tally.
  `run_dream_cycle` sums llm_calls/llm_errors from the extractors via a
  new structured `LLMExtractor.error_counters()`; `run()` passes the
  counters out of its result dict. The summary regex survives only as
  the fallback for a caller holding nothing but dream.log text, and is
  now pinned against `recall.health._parse_llm_errors` on one fixture.
- digest_cli `incremental` writes runtime/digest_status.json itself.
  sync_claude_extras drops the parse-and-mirror step: it quotes the
  printed summary line into its log and keeps exit-code semantics.
- sync_claude_extras: `_env_float`/`_env_int` collapse into `_env_num`.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Four places where the same knowledge was written down twice.

- auto_migrate_install `_launchd_path()` builds the generated unit's
  PATH from `llm_providers.base.FALLBACK_BIN_DIRS` (via a new public
  `fallback_bin_dirs(home)`, which `find_cli` now shares) plus the
  system dirs. Held as two hand-written lists, the provider lookup could
  resolve `claude` in a dir the scheduled job could not exec it from.
  The staged brain in tests/test_auto_migrate.py gains llm_providers/,
  which install.sh's rsync always copies alongside the helper.
- render_pending_summary: one `_in_last_run` generator owns the backward
  scan's two boundary rules (health lines are transparent; stop at the
  previous run's terminal marker) that quarantine, remote-error and
  held-back-path each re-derived. A render now reads sync.log once,
  seeking to the tail instead of pulling an append-only file that grows
  with the user's uptime, and scans for held-back paths once, so the
  status word and the file list beside it describe the same run.
- llm_providers: `_bin` and the CLI-not-found wording move to the base
  class; each provider supplies only its name and install hint.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The installer carried BRAIN_ROOT to helpers and to its own recursive
sub-invocations with roughly two dozen hand-written per-command
assignment prefixes. Every new sub-invocation had to remember one, and
the ones that forgot wrote to ~/.agent on a custom --brain-root install
without saying so.

Argument parsing settles BRAIN_ROOT and nothing below reassigns it, so
export it there once and drop the prefixes. Verified with a --minimal
install into a throwaway HOME under a custom --brain-root and no
BRAIN_ROOT in the environment: the brain lands at the custom root,
$HOME/.agent is never created, and no config picks up the exported
value.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
One predicate reads better than a nested guard, and matches the
`elif` the three original scans each spelled out.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…ving

Duplication removed:
- `_wire_to_serialized` was byte-identical in cli.py and mcp_server.py ->
  `recall.serialize.wire_to_serialized`. Two copies of the CLI/MCP JSON
  contract is two chances for them to drift.
- Three hand-rolled atomic text writes (health, utilization, lint) ->
  `recall.fsutil.atomic_write_text`; lint's `_atomic_write` keeps its bool
  return by catching the exception.
- `_as_int` / `_as_list` (+ `_as_float`, `_as_mapping`) and `_format_window`
  were duplicated between stats.py and utilization.py -> `recall._coerce`;
  `_format_window` now has one signature (`since_ts_ms`).
- `_memory_root` was copied in lint_claims and lint_digests -> `lint.memory_root`;
  `_string_claim_id_raw` now reuses a text-based `lint.frontmatter_bounds`,
  which `_read_frontmatter_bounds` also delegates to.
- health's two size checks -> one `_size_threshold_result`.
- hooks' scalar merge and `_merge_budgets` -> one `_first_valid`.
- `load_events_all` -> `load_events` per rolled path.

Work removed:
- `stats._build_report` folded ~12 per-field list passes into three loops
  (partition / worker population / hits); `_percentiles` sorts once for
  p50+p95. Verified against the previous implementation over 600
  randomized reports including malformed values: zero differences.
- health: `_claude_project_memory_files` memoised per run (two checks
  walked every ~/.claude project); `sync.log` remote-error scan tail-reads
  the last 400 lines instead of slurping an unbounded log; daemon connect
  timeout 0.5 -> 0.15 s; `check_brain_push` computes `age_h` once.
- daemon: `_model_info` memoised once a retriever exists, `datetime` +
  `recall.sanitize` imports hoisted to module level.
- core: the post-rerank sort now runs only when reranking happened —
  without it the list was already in `_rank_key` order.

Dead code removed:
- `qdrant_backend.query_hybrid_rerank` (no callers, not even tests).
- `RecallDaemon.cfg` and `DaemonAlreadyRunning.pid` (assigned, never read;
  the pid is already in the message), the unreachable
  `if args.curve_out is not None` guard, and the impossible try/except in
  `_warm_default`.
- `lint_claims._infer_stub_min_chars`: the one production caller always
  passed the threshold explicitly, so `render_claim_manifest` now takes
  `stub_min_chars: int = STUB_MIN_CHARS`.
- The stdlib-only `daemon_client` import no longer needs ImportError
  guards in cli.py; `daemon_client.request` uses one `_arm_timeout` for
  its three identical deadline blocks.
- `calibrate_rerank_gate.score_pairs` reads `RERANK_TEXT_CAP` from
  qdrant_backend instead of repeating 2000.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Splitting the tail read into a seeking core plus a swallowing wrapper
lost one distinction the old whole-file read made: a sync.log that
exists but cannot be opened told us nothing about the last sync, and
must not fall through to the mtime check and come back 'ok'. The status
check now reads through the raising core and says 'missing', and
_status_inputs hands over an empty tail as None so that read still
happens. Pinned by a test.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…ss of test order

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…erank pool is rerank_n deep with policy=ignore

Codex review pass 3, two P2 findings:

* recall_query_handler fell back to the in-process retriever on EVERY
  DaemonUnavailable, including timeout / protocol_error / server_error —
  cases where the daemon is UP and holds the embedded store's exclusive
  lock, so the fallback blocked on fcntl and surfaced as "index is busy".
  It now falls back only on the DOWN reasons and raises a RuntimeError
  naming the real cause otherwise. The reason set is one constant,
  daemon_client.DAEMON_DOWN_REASONS, shared by the CLI, the daemon's
  stale-socket probe and the MCP handler instead of three private copies.

* With needs_review_policy=ignore the RRF leg fetched exactly k candidates,
  so for a single-collection brain the cross-encoder could only reorder the
  RRF top-k and rerank_n meant nothing. The pool is now max(k, rerank_n)
  whenever reranking is on (per-request override included); ignore+no
  reranker stays at k.

Also: the two real-model daemon tests measured the machine, not the
daemon — a 10 s readiness wait against a 17 s model warm-up and a 2 s
queue bound against four serialized reranked queries. Real retrievers now
get a 120 s readiness wait and the concurrent test declares a client
budget the daemon queues against.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…ardown abort cannot discard finished work

Under load the venv's grpcio (imported by qdrant_client) aborts at
interpreter teardown — libc++abi recursive_mutex lock failed, exit 134,
sometimes SIGSEGV — after the program finished (3 of 20 bare imports at
load 10+ on 2026-09-04; 0 of 45 at load 3). Claude Code adds a hook's
stdout to the context only on exit 0, so the UserPromptSubmit hook lost
the injection it had just printed and telemetry recorded a hit nobody saw;
sync.sh, the dream lint step and the test suite read the same abort as a
failed run.

recall._exit.hard_exit flushes stdio, runs the atexit handlers we rely on
(the embedded store's close) and leaves through os._exit, skipping the
finalisation where the abort happens. The console script now enters via
recall.cli:main, which carries Typer's exit code out through it; the hook
script does the same. recall doctor's hook-interpreter probe decides by a
stdout sentinel printed after the import, not by the return code, so a
healthy interpreter that aborts at teardown is no longer reported as
missing qdrant_client (staff follow-up review, M2).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…machine has none

On a machine with no user.name/user.email anywhere (fresh laptop, CI runner,
service account) the seed commit died with 'Author identity unknown' after
the brain directory was laid out and before the hooks, LaunchAgents and
daemon were installed: exit 128, half an install (2026-09-08 full-day QA in
an empty sandbox HOME). The installer now sets a repo-local identity
(brainstack <brainstack@localhost>) on the brain when neither git config nor
GIT_AUTHOR_*/GIT_COMMITTER_* provide one, says so, and leaves a configured
identity alone. Repo-local on purpose: the hourly sync.sh commit runs under
launchd with a minimal environment and reads the same .git/config.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…rd acks before they cost a query

Full-day QA (2026-09-08) in an empty sandbox HOME, read as a user:

* The install summary printed '✓ Claude Code auto-recall: done' and
  '✓ Recall-first directive: done' on a machine with no ~/.claude, ~/.codex
  or ~/.cursor — the sub-steps had (correctly) skipped every host. A reader
  believes the hook is installed. The summary now says '• ... skipped (...
  not found; re-run ... after installing it)' and the recall-first sub-step
  no longer announces 'first-line resource on all installed hosts' over
  three skips.

* 'ok thanks' fired a real daemon query: the ack list knew only bare words,
  and punctuation inside a phrase ('OK, thanks!') defeated the rstrip-only
  check. Acks are normalised (lower-case, punctuation dropped, whitespace
  collapsed) and the list gains the common two-word acks and go-ahead
  phrases; an ack word inside a real question still fires.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…health.json' by the file, not the exit code

Staff follow-up review, M1. The EXIT trap runs 'recall health' after the
run's terminal marker and appended its stderr to sync.log un-prefixed. The
remote-error, quarantine and oversize scanners walk the log backwards and
treated any non-'health:' line as a run line, so a warning, a traceback or
a grpcio teardown abort below the marker made the current run's own marker
end the scan before the git stderr above it: every real failure read as
'no error' for that run. Reproduced with both parsers.

* sync.sh writes recall's stderr into the log prefixed 'health: stderr:'
  (last 20 lines), and reports 'wrote runtime/health.json' when the file is
  not older than a stamp taken before the run — a venv whose grpcio aborts
  at teardown returns 134 after a good write. Only tools launchd's minimal
  PATH is guaranteed to have are used (no mktemp/tail/stat; the test
  sandbox's binary whitelist caught the first draft).
* Both parsers anchor on a run's OWN lines: 'sync:'-prefixed lines and git
  stderr (claimed lines). Anything else below the marker belongs to no run.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…; say so when sync has stopped

Full-day QA, 2026-09-08. launchd labels are per-USER, not per-HOME:
'launchctl unload <plist in a sandbox HOME>' unloads the real user's job of
that Label. install.sh --uninstall (what uninstall.sh delegates to) and the
claude-extras setup/remove paths called launchctl without checking
BRAINSTACK_SKIP_LAUNCHCTL, so the 2026-09-04 and 2026-09-08 QA sandboxes
each unloaded the live nightly dream and hourly sync agents. The live brain
then showed 'dream_cycle FAIL (87h ago)' and three days of unpushed commits,
and nothing at session start said why: the SessionStart banner is silent
when runtime/health.json is missing, and the agent that writes it was the
one that had been unloaded.

* Every launchctl call goes through _launchctl, which is a no-op under
  the skip flag; three tests drive --uninstall, --remove-claude-extras and
  --setup-claude-extras against a recording fake launchctl.
* SessionStart prints one line when there is no health report but the
  brain's sync.log was last written more than 26 h ago (sync agent dead or
  unloaded); a recent sync.log or no sync.log stays silent.
* The three-opt-outs hardening test now provides ~/.claude, since the
  summary reports the hook default as skipped when Claude Code is absent.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…CLI helper's --quiet mode survive set -e

Codex review pass 4 (P1): the console-script entry point moved to
recall.cli:main, but bin/install-recall-cli.sh skipped 'pip install -e'
whenever .venv/bin/recall already existed, so every EXISTING install kept a
wrapper importing recall.cli:app and bypassed hard_exit. The helper now
regenerates the wrapper when it does not enter through main.

Writing the test exposed a second, older defect: log() was
'[ "$QUIET" -eq 0 ] && echo', which returns 1 when quiet, and the script
runs under set -e — so 'install.sh --upgrade' (which calls the helper with
--quiet || true) has been dying at the first log line and silently skipping
the whole CLI step. log() is now an if-statement.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…ed health stderr; guarded hook exit import; git-var identity test

Staff delta review (APPROVED WITH SUGGESTIONS), the four MINOR items:

* M1 — a stray un-prefixed line that merely contains a marker phrase
  ('UserWarning: previous push failed, see log') ended the scan in both
  scanners and lost the real remote error. Only a sync:-prefixed line is a
  run's own line now; every marker sync.sh writes already is one.
* M3 — _check_sync_status picked the run's last line by substring 'sync:',
  so a 'health: stderr:' line quoting an old 'sync: ... push failed' flipped
  a pushed run to blocked-network. It now uses the same run-line predicate.
* M2 — the hook's __main__ imports recall._exit unguarded, against the
  module's 'usable without recall' contract; guarded with a sys.exit
  fallback (no grpc to fear on such a machine).
* M4 — the installer decides 'no git identity' with git var
  GIT_AUTHOR_IDENT / GIT_COMMITTER_IDENT, the way git commit will, so EMAIL
  and a lone GIT_AUTHOR_EMAIL are handled like git handles them.
* N6/N9 — helper comment no longer overclaims; CHANGELOG notes the MCP
  error-surfacing change.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…n it (the hook keeps its own superset)

Staff delta review N8.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…ured, not only when git would refuse

CI (macos runner) auto-detects a sane runner@host.local identity, so the
git-var-only check from the delta review skipped the seed and the identity
test failed there. Seed when git var fails OR when neither git config nor
GIT_AUTHOR_EMAIL/GIT_COMMITTER_EMAIL/EMAIL provide an identity: a brain's
history should not be built on a guessed address.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@mustafa-bharmal-shipveho
mustafa-bharmal-shipveho merged commit a33e1a2 into main Sep 8, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant