feat(linkedin-studio): SB-S3d — operations.md ops centre (strategy-advisor reader) [skip-docs]

Make brain/operations.md a READ tributary — the "operations centre" half of the
second brain. strategy-advisor now reads the dated "who I am now" anchor and
honours the frozen-past-self guard: when a profile.md fact predates or
contradicts the anchor, the anchor deprecates it (advisory/reader-side; NO
consolidate-engine change). Anti-sycophancy is INVERTED vs the profile —
profile facts stay evidence-to-TEST, the user-declared anchor is honoured.

- scaffold.ts operationsSeed(): dated-anchor convention (_As of YYYY-MM-DD:_) +
  Plans/Ideas guidance; existence-skip idempotency preserved (no-clobber green).
- strategy-advisor.md: operations.md in Step 0 context-load + a consumption
  contract (anchor authoritative, inversion, plans-vs-ideas, graceful absence).
- test-runner.sh Section 16e: 2 unconditional checks (non-vacuity self-test +
  wiring grep, sibling-file decoy); ASSERT_BASELINE_FLOOR 80->82; BRAIN floor 113->114.
- architecture.md:80: build-row reconciled (S3d done; S3e = dead content-history
  retirement + triple-post reconciliation = the new LAST S3 slice).

Gate 97/0/0; brain 114/114. TDD: RED proven (16e Check B + the scaffold
dated-anchor test both failed pre-fix) before GREEN. Splits the old S3d charter;
the hygiene half is deferred to SB-S3e. Light-Voyage hardened (scope-guardian
ALIGNED, brief-reviewer + plan-critic folds in docs 0061bf2).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RigJBiRFNtFZKCz21qNbQ4
This commit is contained in:
Kjell Tore Guttormsen 2026-06-23 21:28:26 +02:00
commit 974e8d1b25
5 changed files with 97 additions and 8 deletions

View file

@ -52,14 +52,25 @@ function indexSeed(): string {
function operationsSeed(): string {
return `# Operations
> The operations centre where you're headed now, what you're working on, what you might
> do next. User-authored: the brain motor never writes here (a re-run of init never
> re-touches an existing file, so your edits are safe).
## Who I am now (anchor)
<!-- Frozen-past-self guard: a periodic, user-authored "where I'm headed now"
statement that deprecates older inferences. Update it when your direction shifts. -->
<!-- Frozen-past-self guard: a DATED, user-authored "where I'm headed now" statement.
It deprecates older inferences when a profile.md fact predates or contradicts this
anchor, the anchor wins. Re-date it when your direction shifts. -->
_As of YYYY-MM-DD:_ <one or two sentences on your current direction replace this line>
## Plans
<!-- Active commitments — what you're working toward now. One per line. -->
## Ideas
<!-- Parking lot — possible content/strategy ideas, not yet commitments. One per line. -->
`;
}

View file

@ -57,6 +57,18 @@ describe("initBrain scaffold (SC1)", () => {
assert.match(ops, /## Ideas/);
});
test("operations.md ships a dated frozen-past-self anchor convention (SB-S3d)", () => {
initBrain();
const ops = readFileSync(join(root, "brain/operations.md"), "utf8");
// RED-bearing literal: the dated-anchor convention is the genuinely-new SB-S3d seed
// content (absent pre-S3d). The frozen-past-self guard is temporal — the anchor must
// carry a date the reader can compare against a profile fact's last_seen.
assert.match(ops, /_As of YYYY-MM-DD:_/, "anchor ships the dated convention");
// Non-RED companion (already shipped pre-S3d, asserted only to lock the guard wording
// the reader keys on — NOT the failing literal).
assert.match(ops, /deprecates older inferences/);
});
test("a second invocation is a no-op — every target skipped, content unchanged", () => {
initBrain();
const before = EXPECTED_FILES.map((f) => readFileSync(join(root, f), "utf8"));

View file

@ -33,8 +33,10 @@
# never baked into the agent — with a non-vacuity self-test) in Section 17; the brain
# profile-reader guard (SB-S3a: strategy-advisor names brain/profile.md AND carries the
# anti-sycophancy literal 'evidence to TEST', with a non-vacuity self-test) in Section
# 16d; the assertion-count anti-erosion floor (SC6) in Section 18. All are live below
# (Sections 818).
# 16d; the brain operations-reader guard (SB-S3d: strategy-advisor names
# brain/operations.md AND carries the frozen-past-self literal 'deprecates older
# inferences', with a non-vacuity self-test) in Section 16e; the assertion-count
# anti-erosion floor (SC6) in Section 18. All are live below (Sections 818).
#
# Usage: bash scripts/test-runner.sh
# bash 3.2-safe: plain arrays only, no `declare -A`, no `mapfile`/`readarray`.
@ -713,7 +715,7 @@ if [ -x "$BR_DIR/node_modules/.bin/tsx" ]; then
BR_OUT=$( set +e; (cd "$BR_DIR" && npm test) 2>&1; echo "BR_EXIT:$?" )
BR_EXIT=$(echo "$BR_OUT" | grep -oE 'BR_EXIT:[0-9]+' | grep -oE '[0-9]+' | head -1)
BR_TESTS=$(echo "$BR_OUT" | grep -oE 'tests [0-9]+' | grep -oE '[0-9]+' | tail -1)
BRAIN_TESTS_FLOOR=113 # SB-S0 34 [id(11)+profile(6)+fold(12)+scaffold(5)] + SB-S1 29 [ingest(14)+publish(9)+cli(6)] + SB-S2 19 [consolidate(12)+consolidate-cli(7)] + SB-S3b 12 [consolidate(10)+consolidate-cli(2)] + SB-S3c 19 [ingest(4)+publish(3)+assemble(8)+cli(4)]
BRAIN_TESTS_FLOOR=114 # SB-S0 34 [id(11)+profile(6)+fold(12)+scaffold(5)] + SB-S1 29 [ingest(14)+publish(9)+cli(6)] + SB-S2 19 [consolidate(12)+consolidate-cli(7)] + SB-S3b 12 [consolidate(10)+consolidate-cli(2)] + SB-S3c 19 [ingest(4)+publish(3)+assemble(8)+cli(4)] + SB-S3d 1 [scaffold dated-anchor seed]
if [ "$BR_EXIT" = "0" ] && [ -n "$BR_TESTS" ] && [ "$BR_TESTS" -ge "$BRAIN_TESTS_FLOOR" ]; then
pass "brain suite green: $BR_TESTS tests pass (floor $BRAIN_TESTS_FLOOR)"
else
@ -831,6 +833,56 @@ fi
echo ""
# --- Section 16e: Brain Operations Reader (SB-S3d) ---
echo "--- Brain Operations Reader ---"
# SB-S3d wires strategy-advisor to read the second-brain OPERATIONS centre: it must
# (a) name brain/operations.md as a context source AND (b) carry the frozen-past-self
# literal 'deprecates older inferences' (architecture.md:59 — the dated "who I am now"
# anchor outranks/deprecates older profile inferences; advisory/reader-side). Both
# literals are required, grepped EXACT with grep -F: a loose 'operations' pattern would
# match generic prose, and naming the sibling brain/profile.md must NOT satisfy the
# operations literal. Non-vacuity self-test mirrors Sections 8/13/16c/16d: a probe counts
# as "wired" iff it carries BOTH exact literals; probes missing either (incl. a sibling-
# file decoy naming brain/profile.md) must NOT count as wired. The wiring is gate-enforced;
# the agent's runtime OBEDIENCE is verified manually (SC6/SC7 at land — agent-prompt
# behaviour is not unit-testable; the brief states this honestly).
OPS_LIT='brain/operations.md'
ANCHOR_LIT='deprecates older inferences'
ops_reader_wired() { # $1 = text; wired iff BOTH literals present (echo twice — grep consumes stdin)
echo "$1" | grep -qF "$OPS_LIT" && echo "$1" | grep -qF "$ANCHOR_LIT"
}
OPS_SELFTEST_OK=1
if ! ops_reader_wired "reads brain/operations.md; the anchor deprecates older inferences"; then
OPS_SELFTEST_OK=0; echo " non-vacuity FAIL: a fully-wired probe was not detected"
fi
while IFS= read -r probe; do
[ -z "$probe" ] && continue
if ops_reader_wired "$probe"; then
OPS_SELFTEST_OK=0; echo " false-positive FAIL: under-wired probe accepted -> $probe"
fi
done <<'NEGATIVE16E'
reads brain/operations.md but never says the anchor outranks anything
the anchor deprecates older inferences but names no source file
reads brain/profile.md and tests the evidence
NEGATIVE16E
if [ "$OPS_SELFTEST_OK" -eq 1 ]; then
pass "ops-reader self-test: full wiring detected; 3 under-wired forms rejected (incl. sibling-file brain/profile.md decoy)"
else
fail "ops-reader self-test failed — the ops-reader-wiring lint is vacuous or over-eager"
fi
SA_OPS="agents/strategy-advisor.md"
if grep -qF "$OPS_LIT" "$SA_OPS" && grep -qF "$ANCHOR_LIT" "$SA_OPS"; then
pass "strategy-advisor.md wired to brain operations reader (names '$OPS_LIT', frames '$ANCHOR_LIT')"
else
fail "strategy-advisor.md missing brain operations reader wiring — needs both '$OPS_LIT' and '$ANCHOR_LIT'"
fi
echo ""
# --- Section 17: De-Niche Guard (B-S1 + B-S2) ---
echo "--- De-Niche Guard ---"
@ -905,12 +957,13 @@ echo ""
# brain-suite floor (Section 16b) = 75; +3 for SB-S1's three UNCONDITIONAL Section-16c
# checks (published-only self-test + voice-trainer grep + contract-doc grep) = 78;
# +2 for SB-S3a's two UNCONDITIONAL Section-16d checks (profile-reader self-test +
# strategy-advisor wiring grep) = 80.
# strategy-advisor wiring grep) = 80; +2 for SB-S3d's two UNCONDITIONAL Section-16e
# checks (ops-reader self-test + strategy-advisor ops-wiring grep) = 82.
# NB: the floor tracks the deps-absent MINIMUM (conditional TS suites warn-skip and drop
# the count), so it is bumped only by UNCONDITIONAL new checks — NOT pinned to the
# deps-present TOTAL_CHECKS (that would zero the warn-skip margin and false-fail a fresh
# clone). Runs last so TOTAL_CHECKS sees every prior check.
ASSERT_BASELINE_FLOOR=80
ASSERT_BASELINE_FLOOR=82
TOTAL_CHECKS=$((PASS + FAIL))
if [ "$TOTAL_CHECKS" -ge "$ASSERT_BASELINE_FLOOR" ]; then
pass "assertion-count anti-erosion: $TOTAL_CHECKS checks >= baseline floor $ASSERT_BASELINE_FLOOR"