Skip to content

feat: Cortex v4.0.0 — signal-first, zero-decision#80

Merged
fermonterom merged 5 commits into
mainfrom
feat/v4-signal-first
Jul 2, 2026
Merged

feat: Cortex v4.0.0 — signal-first, zero-decision#80
fermonterom merged 5 commits into
mainfrom
feat/v4-signal-first

Conversation

@fermonterom

Copy link
Copy Markdown
Owner

Why

Three months of data showed the learning pipeline structurally frozen: last real law and skill promoted 2026-05-16, 88.5% historical proposal rejection, new instincts/month collapsing 43→15→6→0. Root causes (full forensics in docs/audit-cortex-2026-07-02.md and design rationale in docs/DESIGN-V4.md):

  1. Capture starved every detectorobserve.py rarely populated output/err_msg, so error-fix proposals were garbage (grep headers and npm listings mistaken for errors).
  2. Commands required human decisions — 20+ interactive cx-* commands could not be scheduled; maintenance depended on memory and, when run, reported "nothing to do" because the signal had died upstream.
  3. Promotion gated on a manual flag (law_eligible: true) that no automated path ever set: 0/71 instincts had it while 35 sat above the confidence threshold for 42-66 days.

What

  • Capture (port inspired by sinapsis, MIT): tool output captured (10k cap), real err_msg line extraction, word-boundary error patterns + anti-false-positive guards ([codex]/npm prefixes, version listings, grep headers) with strong-error-token override.
  • Confirmation thresholds: instincts born status: draft (tracked, never injected) → confirmed only at ≥5 occurrences across ≥3 sessions. Single-evidence auto-accept removed; error-recovery moved to human validation.
  • Deterministic law promotion: conf ≥0.95 + seen in ≥3 projects (YAML ∪ tracking ∪ filesystem) + occurrences_v4 ≥10 + no recent noise. Source instinct auto-archived after promotion. Laws derive prose, never raw trigger regex (fixes the 40-char truncation corruption). law_eligible:false remains an explicit veto; the manual :true requirement and the auto-distill-candidates.md mailbox are gone.
  • Command consolidation 24→7: /cx-maintain (deterministic, cron-able: decay+dedup+purge+promotion+rotation+reconciliation+health), /cx-review (the ONLY human command: one weekly shorthand digest), /cx-eod (cumulative 24h, next-day Eisenhower block in SessionStart), /cx-status, /cx-gotcha, /cx-backup, /cx-restore. 17 legacy commands become deprecation stubs (docs/MIGRATION-V4.md).
  • Injector hardening: hollow-JSON and prompt-injection guards, draft filter, subtopic dedup (replaces domain-bucket monopoly), degenerate-trigger (Tool|pattern) static skip, byte-stable ordering.
  • Honest metrics: reflex counter units unified with resetAt; daily-summaries rotation archives instead of deleting.

Verification

  • 38/38 test suites, 693 passed / 0 failed (4 legacy suites rewritten to the v4 contract, retired asserts marked # retired in v4).
  • Sandbox install + live upgrade v3.38.2 → v4.0.0 clean; /cx-maintain executed twice against real data: idempotent, produced a 21-item review digest, updated markers.
  • Adversarial review (GPT-5.5) found 2 critical + 3 major integration bugs pre-merge; all six fixed with paired tests in 19cc216.
  • Pre-push gate: 7/7 checks + AI review pass.

🤖 Generated with Claude Code

fermonterom and others added 5 commits July 2, 2026 14:55
…ision)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…inistic promotion, command consolidation

- observe.py: tool output capture (10k cap) + real err_msg line + anti-false-positive guards
- session-learner.js: draft/confirmed states (5 occ / 3 sessions), tool-name stopwords, action quality guards, per-proposal project attribution
- distill_engine.py: deterministic law promotion (conf>=0.95 + 3 projects + occurrences_v4>=10), source instinct auto-archive, trigger prose derivation (no raw regex in laws), candidates mailbox removed, error-recovery moved to human validation
- injector-engine.js: hollow-JSON + prompt-injection guards, draft filter, subtopic dedup, degenerate-trigger skip
- commands: /cx-maintain (deterministic, cron-able) + /cx-review (single human digest) + cumulative /cx-eod; 17 legacy commands deprecated to stubs
- session-start.py: review badge, EOD next-day Eisenhower matrix, maintain reminder

Contract: docs/DESIGN-V4.md + docs/SPEC-PORT-SINAPSIS.md

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
… docs & version quad-sync 4.0.0

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…raft status, codex guard, summaries archive

Adversarial review (Codex GPT-5.5) found 2 critical + 3 major + 1 minor:
- occurrences_v4 now incremented by the single YAML writer (session-learner)
- _count_distinct_projects merges YAML + instinct-tracking + filesystem
- auto-validated proposals born status:draft (5occ/3sessions contract holds)
- strong error tokens override log-prefix guards ([codex] error: ... detected)
- daily-summaries rotation archives instead of deleting
- cx-status reads last_seen with lastSeen fallback

Suite: 38/38 files, 693 passed / 0 failed. Live reinstall verified.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…gnored

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@fermonterom
fermonterom merged commit 765f5a3 into main Jul 2, 2026
10 checks passed
@fermonterom
fermonterom deleted the feat/v4-signal-first branch July 2, 2026 14:22
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