Skip to content

Docs tech-debt pass: predicate count, lexicon attribution, terminology, stale counts - #4

Closed
agulaya24 wants to merge 82 commits into
mainfrom
docs/tech-debt-consistency-pass
Closed

Docs tech-debt pass: predicate count, lexicon attribution, terminology, stale counts#4
agulaya24 wants to merge 82 commits into
mainfrom
docs/tech-debt-consistency-pass

Conversation

@agulaya24

Copy link
Copy Markdown
Owner

Documentation tech-debt pass. Tracked docs only; docs/archive and docs/eval/archive untouched; no code identifiers, CLI flags, or MCP URIs renamed (additive-alias policy, prose only). All 451 tests pass after the change.

Changes

File Before After Justification
README.md "46 constrained behavioral predicates" "46 constrained predicates" One of the 46 is the unknown fallback, not behavioral. Standard formulation.
AGENTS.md "47 predicates" (extract line) "46 constrained predicates" CONSTRAINED_PREDICATES in config.py has 46 entries.
AGENTS.md lexicon_schema.yaml = "47-predicate behavioral grammar" Element-type schema for authored containers; predicate vocabulary moved to the config.py row The yaml defines axiom/prediction/context_mode/meta_section containers plus provenance syntax, not predicates.
AGENTS.md "403 tests" "451 tests" pytest --collect-only reports 451.
CLAUDE.md "47 predicates" (extract row) "46 constrained predicates" Matches code.
CLAUDE.md lexicon_schema.yaml = "The 47 behavioral predicates. AUDN-governed." Element-type schema description; config.py row now names CONSTRAINED_PREDICATES Misattribution fix.
CLAUDE.md "403 tests" "451 tests" Actual collection count.
CLAUDE.md AUDN "(Add, Update, Deprecate, NOOP)" "(Add, Update, Delete, NOOP; delete is a soft supersession)" Code enum is ADD/UPDATE/DELETE/NOOP (extract_facts.py:641).
CLAUDE.md "Do not modify lexicon_schema.yaml... schema governs predicates" Split: yaml governs element types; CONSTRAINED_PREDICATES governs extraction Same misattribution in the DO-NOT list.
CLAUDE.md docs/internal/ row and refactor-plan link presented as repo paths Marked as private working copy only, not tracked in this repo git ls-files docs/internal is empty; links were dead in the public tree.
CONTRIBUTING.md "414 tests" (x2) "451 tests" Actual count.
CONTRIBUTING.md "25 subcommands" "27 subcommands" 27 add_parser calls in cli.py.
CONTRIBUTING.md "Three-layer identity authoring" / "Brief composition" step labels "Three-layer specification authoring" / "Specification composition", renumbered steps 4 and 5 Terminology policy plus 5-step pipeline.
CONTRIBUTING.md "Sample briefs for 9 subjects" "Sample specifications for 7 subjects" examples/ contains 7 subject directories.
CONTRIBUTING.md "pipeline has 4 steps" "5 steps: Import, Extract, Embed, Author, Compose" Canonical 5-step description (README, ARCHITECTURE).
CONTRIBUTING.md "47 constrained predicates" "46 constrained predicates (45 behavioral plus an unknown fallback)" Matches code.
ORIENTATION.md "46-predicate behavioral grammar. Defined in lexicon_schema.yaml" Defined as CONSTRAINED_PREDICATES in config.py; yaml described as the container schema Misattribution fix (count was already right here).
ORIENTATION.md "25 subcommands" "27 subcommands" Matches cli.py.
llms.txt "47 constrained behavioral predicates" (x2), "Full schema: lexicon_schema.yaml" 46 constrained predicates; vocabulary pointer to config.py Same two defects in the machine-readable file.
docs/core/ARCHITECTURE.md "47 constrained predicates" (diagram, output format, SQL comment, model roles, D-056 row) 46, with 45+fallback breakdown at first mention Matches code.
docs/core/ARCHITECTURE.md predicate examples included "trades" removed "trades" is not in CONSTRAINED_PREDICATES (removed as non-canonical per config.py history note).
docs/core/ARCHITECTURE.md "400+ tests" "451 tests" Actual count.
docs/core/ARCHITECTURE.md "25 subcommands" (x2) "27 subcommands" Matches cli.py.
docs/core/ARCHITECTURE.md MCP capabilities table: Resource "Identity", tools recall, search memory://specification (identity as deprecated alias), recall_memories, search_facts, plus the missing get_brief/get_stats/get_call_log/get_help rows Actual tool names and surface in mcp_server.py.
docs/core/ARCHITECTURE.md "always-on identity Resource" (x2) "always-on specification Resource" Canonical resource is memory://specification.
docs/core/ARCHITECTURE.md Serving Layer section described 0.3.0 partial serving (CORE-only resource, get_anchors()/get_predictions()) as current Describes the 0.4.0 inline design; 0.3.0 kept as history Version is 0.4.0; those tools no longer exist in mcp_server.py.
docs/core/ARCHITECTURE.md file tree listed docs/research/, docs/reviews/, agents/ removed Directories are not tracked in this repo.
docs/core/DESIGN_PRINCIPLES.md subtitle "Behavioral Compression for AI Identity"; ~40 prose uses of "identity block(s)", "identity layers", "identity model(s)", "identity compression" "The Interpretive Layer Above Memory"; "specification", "specification layers" Phase A terminology policy. Decision IDs, tier values (identity-tier), and quoted decision names untouched.
docs/core/DESIGN_PRINCIPLES.md "47 predicates constrain what can be extracted" "46 constrained predicates" Matches code.
docs/core/EPISTEMIC_AXIOMS.md subtitle "Behavioral Compression for AI Identity" "The Interpretive Layer Above Memory" Terminology policy.
docs/core/FLOW_GUIDE.md "47 constrained predicates"; "three identity layers" "46 constrained predicates"; "three specification layers" Matches code; terminology.
docs/core/MCP_REGISTRY_SUBMISSIONS.md "47-predicate grammar" in draft submission copy "46-predicate extraction vocabulary" Copy is still pending submission; future submissions should be accurate.
docs/core/PROJECT_OVERVIEW.md "47 constrained predicates" (x2), "47 + 30 aliases" 46 (45 behavioral + fallback), "+ 98 aliases" 98 entries in _PREDICATE_ALIASES (extract_facts.py).
docs/core/PROJECT_OVERVIEW.md "Pipeline (4 Steps)", "runs steps 1-4", "Pipeline steps: 4" 5 steps with EMBED restored, "runs steps 1-5" Canonical pipeline includes Embed (required for provenance).
docs/core/PROJECT_OVERVIEW.md "25 CLI subcommands" (x3) 27 Matches cli.py.
docs/core/PROJECT_OVERVIEW.md "MCP tools: 5 tools + 1 resource" "8 tools + 2 resources (one a deprecated alias)" mcp_server.py exposes 8 tools and 2 resources.
docs/core/PROJECT_OVERVIEW.md "Tests passing: 414" 451 Actual count.
docs/core/PROJECT_OVERVIEW.md "Identity Authoring", "Three-Layer Identity Architecture", "identity brief", "always-on identity Resource", "Always-On Identity", "Time-aware identity modeling", etc. specification equivalents Terminology policy; archived 14-step block left as historical record.
docs/eval/TEMPORAL_PREDICTION_STUDY_V2.md "47 predicates" "46 constrained predicates" Live procedure spec; matches code.
docs/eval/TWIN_2K_500_TEST_PLAN.md "47 predicates" (x2) "46 constrained predicates" Live test plan; matches code.
recipes/run_pipeline_on_chatgpt_export.md "47-predicate lexicon... (Add, Update, Deprecate, NOOP)" 46 constrained predicates with config.py pointer; "(Add, Update, Delete, NOOP)" Matches code.
recipes/serve_specification_via_mcp.md 0.3.0 partial-serving description, "five tools", get_anchors()/get_predictions() references, pip install --upgrade baselayer 0.4.0 inline design, eight tools enumerated, get_brief guidance, upgrade via git URL Matches mcp_server.py 0.4.0; package is not on PyPI so the upgrade command was broken.
src/baselayer/agent_guide.py "47 predicates" in the agent-facing CLI table "46 constrained predicates" This text is served to agents via get_help.
src/baselayer/config.py comment "47 verbs covering..." above CONSTRAINED_PREDICATES "46 verbs (45 behavioral plus the unknown fallback)" The comment contradicted the list directly below it.

Scope notes

ORIENTATION.md and llms.txt were not in the enumerated scope list but carried exact instances of defects 1, 2, and 5 (predicate count, lexicon misattribution, subcommand count); fixed and flagged here.

Found but not fixed

  • baselayer-dogfood references: none exist in any tracked file. Nothing to fix (the defect report does not reproduce on this branch).
  • assemble_brief.get_three_layer_identity: the function exists on this branch (src/baselayer/assemble_brief.py:666), and no tracked non-archive doc references it as missing. Nothing to fix here.
  • SERVING_LAYER_PLAN.md / SERVING_LAYER_SPEC.md supersession: on this branch neither file is marked superseded (PLAN header says "Status: In Progress"). The supersession markers appear to live in uncommitted changes on main's working tree. Adding "superseded" notes to citing docs (ARCHITECTURE, DESIGN_PRINCIPLES, PROJECT_OVERVIEW, PROGRESS) would reference a state not in git and would conflict when that change lands. Recommend a follow-up PR after the supersession commit is pushed. The SPEC's "Identity Model Activation" title and internal terminology were left for the same reason.
  • "47 predicates" in docs/eval/OVERNIGHT_RESULTS_S77.md and RESEARCH_STATUS_S78.md: dated result/status snapshots of completed sessions; left to preserve the record. docs/eval/BLIND_AB_TEST.md: the phrase sits inside captured model-generated response text (experiment data); editing it would alter study artifacts.
  • Old terminology across docs/eval/ study documents (BCB_FRAMEWORK "Behavioral Compression Benchmark" is the benchmark's proper name; INTERACTION_QUALITY_TEST_SPEC tested an artifact literally named identity_model.md; TESTABLE_CLAIMS, TEMPORAL_PREDICTION_SPEC, PROMPT_ABLATION_S99, and similar): these are records of completed studies and their hypotheses as run; rewording them would misdescribe what was tested. Left.
  • docs/core/PROGRESS.md and docs/core/DECISIONS.md: session and decision logs; historical terminology and references (e.g. assemble_brief mentions) left as record.
  • llms.txt "arXiv (pending)": the paper appears to be live on arXiv, but the final URL is not verifiable from within this repo; left for the owner to confirm.
  • CHANGELOG.md: historical; untouched by design.
  • Cost figures, model-name strings ("Haiku 4.5"), and validation-score tables in FLOW_GUIDE/ARCHITECTURE/PROJECT_OVERVIEW: not verifiable against code in this worktree; left.

🤖 Generated with Claude Code

agulaya24 and others added 30 commits March 9, 2026 16:36
Behavioral compression pipeline: Import → Extract → Author → Compose.
47 constrained predicates, 414 tests, 76 design decisions.
Validated on 10 subjects across 6 source types (73-82/100).
Twin-2K benchmark: 71.83% accuracy at 18:1 compression (p=0.008).

Apache 2.0. https://base-layer.ai
Radial falloff with per-dot size/opacity variation, 28px spacing, sky-400 color.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Increased dot radius (1.0-2.0) and opacity (0.12-0.55) so the pattern
is clearly visible on GitHub dark and light mode.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
SVG dots were invisible against GitHub's dark background. PNG with
slate-900 background and prominent dot grid renders reliably.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…arent PNG

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- ARCHITECTURE.md: S74 north star, honest local-first→API evolution,
  accessibility improvements, smart links to ablation results
- DESIGN_PRINCIPLES.md: Data Sovereignty honest about API default,
  brain-inspired/surprise-based marked partially superseded per S79 ablation
- FLOW_GUIDE.md: Simplified to 4-step pipeline, updated costs/times,
  added baselayer run one-command version
- PROJECT_OVERVIEW.md: Session 82 metrics, completed milestones,
  subject names with full context
- EPISTEMIC_AXIOMS.md: Expanded jargon and session references for new readers
- All docs: cross-links, first-use explanations, GitHub-relative paths

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Full audit found 37 contamination sources across agent_pipeline.py and
author_layers.py. The compose prompt's literal example sentence was copied
verbatim into 7/11 briefs. Fix: remove all example sentences, ban formulaic
openings, expand blocklist from 11→30+ phrases, add Contamination Gate to
compose output. Franklin recompose test: Gate PASSED, zero template phrases.

Also adds PSYCH_PROFILING_EVAL_SPEC.md (D-078-PSYCH).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Three upstream template sources identified and fixed:
1. ANCHORS: Removed mandatory GENERAL FRAME (was generating identical
   "hold tension explicitly" boilerplate in all 11 anchors layers).
2. CORE: Rewrote internal processing style from leading binary question
   to evidence-required-only (was causing "surfaces problem, already
   pre-processed" in 4/11 briefs from text format, not behavior).
3. COMPOSE: Made [THIN DATA] conditional instead of mandatory (was
   forcing identical "Behavioral prediction data is insufficient"
   boilerplate in 7/11 briefs regardless of actual data coverage).

Also: compose retry with decontamination on gate failure, bumped
author max_contamination_retries 1->3, added 14 new phrases to
blocklist (acknowledge both sides, forcing resolution, etc).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ation (33→0)

Problem: Opus compose step injects pre-training knowledge for famous subjects
despite anonymization and "derive only from input" constraints. Franklin had
18 ungrounded claims, Aarik had 1 inverted claim (brief said opposite of source).

Solution: Split composition into Planner (Opus, sees all layers, outputs
structured claim plan) and Executor (Sonnet, sees ONE claim + its source text
per call, cannot infer identity). Context isolation prevents pre-training
knowledge injection.

Test result on Franklin: Opus-only 33 ungrounded claims → P-E brief 0.
Cost: $0.33 vs $0.25 (30% increase). Pending multi-subject validation.

Files:
- docs/diagnostics/D079_PROVENANCE_ENFORCEMENT_DIAGNOSTIC.md (full analysis)
- scripts/experiments/planner_executor_test.py (test harness)
- docs/core/DECISIONS.md (D-079 entry added)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… variance?

Hypothesis: behavioral brief acts as stabilizer — reduces response variance
across temperature settings compared to no-brief and same-length control.
1,200 API calls, 3 conditions, 4 temperatures, 10 prompts, 2 subjects.
~$10 estimated cost. Falsifiable predictions at each temperature level.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Fixes soft contamination found in v1 multi-subject test:
- Executor prompt bans intensifying adjectives, editorial framing,
  clinical labels, and causal explanations not in source material
- Availability index generated by planner from source layers (not
  assembly hallucinating from pre-training — fixed Buffett 7→0 items)
- Assembly passes planner's availability index verbatim
- Planner output format changed from array to object with paragraphs +
  availability_index keys

v1 results: Franklin 33→0, but Buffett/Aarik/Douglass showed 15-42
soft contamination (embellishment, not biographical injection).
v2 Buffett test: availability index fully grounded, prose quality improved.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Assembly prompt was reordering paragraphs by "concreteness," putting
niche trading scenarios before broad identity patterns. Fix: preserve
planner's paragraph ordering (broadest pattern first, specifics later).
Tested on Aarik — opens with core coherence principle, narrows into
domain-specific patterns.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- ARCHITECTURE.md: reframed around agentic world framing — identity as
  load-bearing infrastructure, owned/auditable/portable brief, removed
  bravado language about AI "knowing you like a friend"
- V5 two-file system: brief_v5.md (cited) + brief_v5_clean.md (stripped),
  served via MCP from clean version
- agent_pipeline.py: auto-generates both cited and clean on compose
- config.py: UNIFIED_BRIEF_FILE -> brief_v5_clean.md, added UNIFIED_BRIEF_CITED_FILE
- mcp_server.py, cli.py, ui.py, generate_website_data.py: updated brief paths
- Experiments: contradiction ablation scripts moved to experiments/,
  result JSONs moved to experiments/results/, new eval/research scripts added
- D-079 prompt ablation report + rubric calibration doc (C28 wins 84.3/90)
- D-080 V5 compose report
- Temporal stability results (Aarik GPT, no direction effect confirmed)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace all hardcoded /home/agulaya and /mnt/c/Users/Aarik paths in
data/swebench/analyze_results.py with pathlib.Path derivations:
- Paths within the repo (ratings file, report output) now use
  Path(__file__).parent relative to the script's own location.
- External OpenHands benchmarks dir now reads from OPENHANDS_BENCHMARKS_DIR
  env var, falling back to the original WSL path as a documented default.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add patentmind_agent.py, baselayer_agent.py, patentmind_state.json
  to .gitignore (Moltbook bot + API key — never commit)
- Add data/swebench/ to .gitignore (live experiment state)
- Add drift results + overnight results dirs to .gitignore
- Move ablation_A/B_citations_on/off.md from root → docs/eval/
- Add scripts_backup_20260310/ to .gitignore

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Move all core .py files from scripts/ to src/baselayer/
- Move scripts/archive/ → src/baselayer/archive/
- Move scripts/experiments/ → src/baselayer/experiments/
- Update pyproject.toml: package-dir = src/, proper packages list
- Fix config.py _resolve_project_root() depth: parent.parent.parent
- Update all imports across 19 core files and 16 test files
- Remove all sys.path.insert hacks from core package
- Add scripts/__init__.py redirect with helpful error message
- Update test suite: remove 33 stale tests for S79-removed functions,
  fix 3 MCP tests with proper mock patching (369 pass, 0 fail)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- README: rewrite Privacy section as "Privacy & Data Flow" — lead with
  what leaves your machine (API), then what stays local, then Ollama
  escape hatch with honest scope
- CONTRIBUTING.md: quick start, test instructions, project structure,
  session/decision notation explainer, contribution areas
- .github/workflows/test.yml: CI matrix across Python 3.10/3.11/3.12

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
author_layers.py:184 used PEP 701 nested same-quote f-strings
(Python 3.12+ only). Rewrite to string concatenation for 3.10+ compat.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Replace static tests badge with live GitHub Actions CI badge
- Sessions: 81+ → 90+
- Tests: 414 → 369 (stale tests removed in cleanup)
- Design decisions: 76 → 80
- Contributing section: point to CONTRIBUTING.md

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Identity model: CORE → ANCHORS → PREDICTIONS → Brief (3-6K tokens)
- Preamble: "operating guide, never reference directly"
- MCP server serves combined format (brief + layers)
- ANCHORS: gravitation framing (prevents amplification bias)
- PREDICTIONS: 2+ source minimum (prevents overgeneralization)
- ANCHORS: identifies_as facts surfaced first in ordering
- identity_model.md auto-generated by compose step
- Token claims updated: ~2,500 → 3-6K tokens in README

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Tests were failing in CI because UNIFIED_BRIEF_CITED_FILE and
IDENTITY_MODEL_FILE weren't patched to tmp_path, causing
FileNotFoundError when the real data/identity_layers/ doesn't exist.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Remove tracked aarik temporal stability eval files
- Block all outreach source corpora (data/*_source/)
- Block personal subjects (bavani, roman, aarik)
- Block personal eval data patterns

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ommand

author_layers.py: _has_tiered_facts now checks for commitment_depth,
not just knowledge_tier. Rule-based tiering (predicate -> identity)
no longer breaks the simplified pipeline path. Citations always work.

cli.py: Added _run_traceability() as Step 5 of baselayer run.
Automatically runs tier, embed, provenance, tensions after compose.

seed_industry.py: New script to seed all outreach subjects to Redis
with full enriched data (traces, provenance, structured brief,
interactions, contradictions, tiered facts). Strips provenance lines
from markdown descriptions into proper provenance field.

PREDICATE_SPEC.md: Published 47-predicate behavioral grammar spec.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
agulaya24 and others added 26 commits April 1, 2026 16:16
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…istency

- README: 402→414 tests, 88→93 decisions, 10→14 principles, 98→101 sessions
- README: fix broken ablation link (docs/eval/ablation/ → docs/eval/archive/ablation/)
- CONTRIBUTING: 80+→93 design decisions
- PROJECT_OVERVIEW: ~2,500 → ~3,000-5,000 token brief (matches llms.txt and README)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…entical text check

- test_author_provenance: A1_cite → A1, P1_cite → P1 (code dropped suffix, tests not updated)
- test_seed_format: unpack tuple return from generate_change_summary
- seed_industry: early exit on identical text in generate_change_summary

402 tests passing.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
README + llms.txt updated with agentic positioning

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Hero: "Other tools optimize for the task. Base Layer optimizes for you."
- Subjects: 44+ -> 57+
- Vision: reframed from personalization to agentic alignment + constraint layer
- Limitations: temporal trajectory in research, not "no model of change"
- Active research: added temporal trajectory, 66-model collective review, failure modes, stacking findings
- Core framing: AI never knew, not AI forgot

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1,082 lines -> 468 lines. Cut all historical/ceremonial content.
- Problem reframed: "AI never knew" not "AI forgets"
- Removed brain metaphors, old layer descriptions, speculative sections
- Design decisions table with one-phrase explanations
- Pipeline steps 1-5 with schema, data flow, and rationale
- Current state only, no archaeological layers
- 57+ subjects, 3-6K token briefs, 101+ sessions

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- README: "The behavioral layer for AI agents", behavioral specification language
- ARCHITECTURE.md: operating guide → behavioral specification, operational constraints
- PROJECT_OVERVIEW.md: personal AI memory → behavioral alignment infrastructure
- DESIGN_PRINCIPLES.md: personal memory system → behavioral specification system
- llms.txt: full rewrite — behavioral specifications, agent alignment framing
- pyproject.toml: updated description and keywords
- cli.py: Personal AI Memory System → Behavioral Alignment for AI Agents
- author_layers.py: CORE layer label + domain guard updated
- mcp_server.py: identity model → behavioral specification in preamble
- test_unified_brief.py: assertion updated to match new preamble

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…arch docs

Serving layer prototype — the behavioral diff cascade:
- serving_engine.py: core logic — load spec, retrieve facts, generate responses,
  compute diff. Mem0-faithful baseline (Chhikara et al., 2025). Multi-subject support.
- serving_tui.py: Textual TUI visualizing the cascade live. 7 panels showing
  Mem0 vs Base Layer retrieval divergence, spec activation, three response conditions.
  Non-blocking startup, error logging, embedding cache.
- question_battery.py: 50 questions across 10 topics, mechanical measurements only.
  No subjective scoring. Maps structural divergence by topic.
- question_battery_subject.py: Multi-subject version for cross-validation.

Research documentation:
- SERVING_LAYER_PLAN.md: full architecture — the diff as identity signal, daemon design
- SERVING_LAYER_EVAL.md: 6-condition eval spec including C6 model-routed activation
- TEMPORAL_PREDICTION_STUDY_V2.md: clean temporal split design (v1 failed)
- BEHAVIORAL_INFLUENCE_COMPLETE_PLAN.md: complete research plan with collective review
- SERVING_LAYER_RESEARCH_BRIEF.md: briefing doc for external feedback

Key findings (S102):
- 18/19 retrieval divergence between Mem0 and Base Layer on same fact store
- Spec consistently produces fewer lists, more questions (conversation vs info dump)
- Relationships topic shows highest structural divergence (4.75 avg)
- AlpsBench proved recall != alignment — Base Layer fills that gap

Experimental — not production. Requires anthropic + openai + sentence-transformers.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Optional last step in the pipeline flow:
  baselayer run <file>     # build the spec
  baselayer export --open  # view it in browser

Generates a single HTML file with tabbed view (Brief, Anchors, Core, Predictions).
No server needed. Dark theme matching base-layer.ai. Self-contained — works offline.

Designed for AI agents (Claude Code, Cursor) to display the spec to users
after a pipeline run, but works for anyone who wants to see what was built.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The always-on memory://specification resource now returns CORE plus a
manifest of additional tools, instead of the full unified specification.
ANCHORS, PREDICTIONS, and the unified brief are exposed as
model-controlled tools (get_anchors, get_predictions, get_brief) the
model calls on demand.

Rationale: empirical work on the Beyond Recall study shows the
specification's largest effect is on interpretation-heavy questions
(judgments, decisions, predictions about the user's behavior), not
literal recall. The manifest tells the model when fetching a layer is
worth the context cost, with concrete trigger examples and a "not a
substitute for the user" caveat.

Baseline MCP context cost drops from approximately 5,000 to 10,000
tokens to approximately 2,500 tokens. The other layers remain available
within one tool call.

Adds:
- get_anchors(), get_predictions(), get_brief() tools with concrete
  trigger language and "not for X" guards
- get_call_log() tool: in-process ring buffer of recent MCP calls,
  queryable by the model for self-inspection
- Per-call stderr logging (format: [base-layer] INFO: mcp_call name=X)

Preserves:
- memory://identity as a deprecated alias to memory://specification
- All five existing tools (recall_memories, search_facts, trace_claim,
  verify_claims, get_stats)

Tests: 422 passing.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…able)

The `baselayer` package name on PyPI is held by an unrelated project
(SkyPortal baselayer, Stéfan van der Walt). Base Layer cannot publish
under that name. Updates user-facing install instructions across the
repo to use `pip install git+https://github.com/agulaya24/BaseLayer.git`
instead, with version-pinning via `@v0.2.0` (paper baseline) or `@main`
(current 0.3.0).

Files updated:
- README.md, AGENTS.md: Quick Start and Setup sections
- llms.txt: reproducibility section
- CHANGELOG.md: 0.3.0 and 0.2.0 reproducibility notes
- docs/core/FLOW_GUIDE.md: Step 1 install
- docs/core/ARCHITECTURE.md: package row in tech stack table
- docs/core/MCP_REGISTRY_SUBMISSIONS.md: install JSON for registry
- recipes/run_pipeline_on_chatgpt_export.md, recipes/serve_specification_via_mcp.md: prerequisites

Historical references to `pip install baselayer` in CHANGELOG.md (older
entries) and docs/core/DECISIONS.md (decision rationale) are preserved
as written.

The paper-baseline source is also vendored directly into the
memory-study-repo at ./baselayer/ so paper readers do not need to
install separately.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Two stale descriptions that still asserted full-spec injection on every
turn:

- docs/core/ARCHITECTURE.md: Serving Layer section was titled "Specced,
  Not Built" and said "current serving path injects the full
  specification every turn". 0.3.0 shipped partial-serving, so renaming
  the section and rewriting the body to cover what shipped, plus a note
  that activation matching remains a future direction.
- recipes/serve_specification_via_mcp.md: goal/expected-output framed
  the always-on resource as loading the full unified specification.
  Updated to describe CORE plus manifest, the on-demand layer tools,
  and the get_call_log inspection path. Added a failure-mode entry for
  "model never calls get_anchors/get_predictions" pointing at the
  stderr log and the Beyond Recall trigger-language rationale.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Two related additions for monitoring and controlling MCP spec serving
without a Claude Code restart.

Toggle:
- New CLI: `baselayer serve enable | disable | status`
- Reads/writes ~/.baselayer/serving_enabled (single character "0"/"1")
- MCP server checks the file on every resource read and on every layer
  tool call (get_anchors, get_predictions, get_brief). When disabled,
  returns a "spec serving paused, run `baselayer serve enable`" message
  instead of content. The model is told to continue helping without
  spec context. Fact-database tools (recall_memories, search_facts,
  trace_claim, verify_claims, get_stats) keep working.
- Mid-session flips take effect on the next MCP call. No restart of
  the server or the host required.
- Default (file missing) is enabled, preserving prior behavior.

Counter:
- ~/.baselayer/mcp_session_count holds an integer call count
- Reset to 0 on server startup, incremented on every _log_call,
  deleted on clean shutdown via atexit handler
- Designed for external monitors (IDE statuslines, scripts) that want
  live call volume without speaking the MCP protocol

Tests: 7 new tests for the toggle covering default-enabled, "0"
disables, "1" enables, and disabled-message return paths for all four
serving handlers. Suite at 429 tests, all passing.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Two related changes for understanding when and why the model decides to
pull from Base Layer.

Per-session storage:
- Replaces the single-file counter at ~/.baselayer/mcp_session_count
  with per-session directories at ~/.baselayer/sessions/<pid>/.
- Each running server writes meta.json (pid, parent_pid, start_time,
  cwd), count (live integer), and log.jsonl (append-only call log).
- Two simultaneously-open Claude Code windows now show independent
  counts instead of sharing one. The statusline finds its window's
  session by matching its own parent PID against the recorded
  parent_pid in each session's meta.
- Sessions persist on disk after the server exits. The atexit handler
  deletes `count` to signal "ended", but meta.json + log.jsonl stay
  for offline analysis.

Reason capture:
- get_anchors, get_predictions, get_brief gain an optional `reason: str`
  parameter. Docstrings ask the model to provide a one-sentence
  rationale for each fetch (e.g. "user weighing a job offer that
  involves a values trade-off").
- The reason is persisted in the per-session log.jsonl, giving a
  record of when in the conversation the model decided it needed each
  layer and why.
- The always-on resource manifest tells the model to include `reason`
  on every layer-tool call.

CLI:
- New `baselayer log list | show | tail | stats` subcommand for
  inspecting traces. `list` shows all sessions with state and counts;
  `show <pid>` prints the full call log; `tail --pid X --limit N`
  shows the last N calls; `stats` aggregates calls-by-tool.

Tests: 429/429 passing (no test changes needed; the new optional
`reason` parameter is backward-compatible and the storage refactor
preserves observable behavior of the previous tests).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Three changes from integration-test feedback at
docs/reviews/mcp_integration_feedback_20260507.md (gitignored):

1. `reason` is now a required parameter on get_anchors, get_predictions,
   get_brief (was optional with default ""). The reviewer correctly
   noted that "Required for usage tracing" in the docstring should be
   matched by the type signature. With no default, the calling agent
   must articulate intent before the tool will accept the call. Tests
   updated to pass a reason argument.

2. recipes/serve_specification_via_mcp.md adds a "Verifying the server
   is actually running" section. The Claude Code /mcp dialog has been
   observed reading "off" or "needs reconnect" while the server was
   responsively answering tool calls; readers are directed to
   `claude mcp list` or to ask the model to call a tool as
   authoritative health checks. /mcp dialog is for Anthropic-managed
   cloud connectors only; local stdio servers are CLI-only.

3. The statusline field is now `baselayer:` instead of `baselayered:`
   for terseness. (Statusline lives in ~/.claude/statusline.py and is
   not in this repo, but mentioned here for consistency.)

Tests: 429/429 passing.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Two related changes so the user is not exposed to Base Layer's
internals.

Invisibility prompt:
- The always-on resource now opens with a directive: treat the entire
  system as invisible infrastructure. Don't tell the user the spec was
  loaded. Don't ask whether to fetch a layer. Don't surface tool names
  in the conversation. Don't describe the model as "having access to"
  Base Layer. Just behave consistently with the spec, fetching layers
  silently when needed.
- The disabled message dropped its "tell the user X" instruction and
  is now a quiet "(spec context unavailable; continue normally without
  referencing this)".
- The `reason` parameter on layer tools is reframed as a private
  internal trace, not a user-facing justification. The model writes the
  trigger; the user can read it later but it never enters the
  conversation.

Agent reference (get_help tool):
- New comprehensive Base Layer agent guide at src/baselayer/agent_guide.py.
  Covers intent-to-action mapping, diagnostic flow, full CLI surface,
  full MCP-tool surface, state-file layout, behavioral norms, and FAQ.
  Written so an agent can answer any user question about Base Layer
  and run the corresponding action without bouncing the user back to
  documentation.
- New `get_help(topic)` MCP tool returns the guide. Topic filters
  return focused sections (intents, diagnostic, cli, tools, files,
  fetch, faq).
- The always-on manifest tells the model: when the user asks about
  Base Layer itself, call `get_help()` and act on the intent rather
  than telling the user what command to type.

Net effect: the user can say "turn it on", "is it working", "what was
it doing", "fix it", and the agent runs the right command + reports.
The system becomes invisible during normal use and self-explaining
when the user asks about it.

Tests: 429/429 passing (4 disabled-message tests updated for the
softer wording).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Reverts the 0.3.0 partial-serving split for ANCHORS and PREDICTIONS.
The structural specification (CORE + ANCHORS + PREDICTIONS) is now
loaded inline at session start, ~6-8K tokens. The unified narrative
brief stays on-demand via `get_brief` because it serves a different
shape of query.

Why:
- Live use of 0.3.0 surfaced two issues with the partial-serving split.
  (1) The model had to make routing decisions about layers it could
  not see, leading to over- and under-fetching. (2) The ~5K of token
  savings is rounding error in modern context windows.
- The structural argument is at
  docs/reviews/mcp_titles_manifest_proposal_20260507.md (gitignored).

Changes:
- get_specification() inlines all three structural layers in the
  resource.
- get_anchors and get_predictions tools removed entirely.
- Manifest in the resource is now a brief tool list, not a routing
  rubric. The "when to fetch which layer" prose was load-bearing only
  for the routing decision; with no routing decision, it's gone.
- get_brief retains its `reason` parameter (private internal trace).
- Agent guide's "When to fetch which layer" section reduced to one
  short paragraph about when to fetch the unified brief.
- Tests updated: TestSpecificationTools now verifies removal; resource
  tests assert all three layers are inlined.
- Version bumped 0.3.0 -> 0.4.0; CHANGELOG entry covers the reversion
  and the rationale.

Tests: 424/424 passing.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…sonal scripts

Prevents committing the 798 MB data/_backup_* and data/_snapshot_* snapshots,
experiment/dataset dirs (experiments, external_datasets, scotus, collective_review),
and outreach scripts that carry personal data (emails, subject names).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
CODEOWNERS, SECURITY.md, CODE_OF_CONDUCT.md, .editorconfig, ROADMAP.md, ORIENTATION.md
for public-repo readiness. tests/test_verify_provenance.py and
tests/test_ingestion_content_preservation.py were part of the running 451-test suite
but untracked; a clean clone was missing them.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… duplicate

docs/research and docs/reviews (the latter already gitignored) plus assorted
internal notes are removed from the public tree; all remain recoverable from
history at 63f2aa8. scripts/mcp_server.py was a 473-line orphaned duplicate of
src/baselayer/mcp_server.py (the registered baselayer-mcp entry point); no code
references it.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…red archive)

scripts/ held an orphaned 2026-04-07 mirror of src/baselayer modules; the live,
shipped code is src/baselayer/ (registered as the console entry points in
pyproject.toml). The 18 duplicate modules are moved to
scripts/archive/legacy_mirror/ (gitignored) — kept locally for reference,
removed from the repo. No code imports the scripts package.
scripts/swebench_harness.py (not a duplicate) is retained.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Cuts ~40% (276 to ~165 lines). Reframes toward the tool's function;
moves detailed paper results to the paper. Adds HF benchmark dataset link
and llms-full.txt. Fixes: 46 behavioral predicates, 451 tests, full-spec
paste-token label, compression section reference.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Pre-existing src/baselayer refactor (per-source extraction caps, IDENTITY_PREDICATES
as config source-of-truth, chunked batch extraction with chunk-level resume, shared
predicate tiering, init_database schema trim, MCP serving via FastMCP instructions,
identity->specification terminology) plus stability hardening:
- pyproject: testpaths=["tests"] so bare `pytest` no longer collects stray tests
- embed.py: UTF-8 stdout/stderr so verification can't crash mid-pipeline (Windows cp1252)
- extract_facts.py: two no-silent-data-loss guards (stale vectors; <50-fact full run)
- tests: guard-predicate unit tests; privacy test now checks src/baselayer/config.py
  (was pointed at the retired scripts/ duplicate)

451 tests pass.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…DME)

The earlier 403->440 bump predated the 11 stability-guard tests that brought the
suite to 451. README (pushed) already says 451; aligning ORIENTATION.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…y, stale counts

- Standardize predicate count everywhere: 46 constrained predicates (45
  behavioral plus an unknown fallback), matching CONSTRAINED_PREDICATES
  in config.py. Fixes 47 and mixed 46/47 claims across docs and source
  comments.
- Correct lexicon_schema.yaml descriptions: it is the element-type
  schema for authored specification containers plus provenance syntax,
  not the predicate vocabulary. Point at config.py as the source of
  truth.
- Terminology alignment per Phase A policy: specification and
  interpretive layer in current prose (DESIGN_PRINCIPLES,
  EPISTEMIC_AXIOMS, PROJECT_OVERVIEW, ARCHITECTURE, FLOW_GUIDE).
  No code identifiers, flags, or URIs renamed.
- Update stale counts verified against code: 451 tests, 27 CLI
  subcommands, 7 example subjects, 5-step pipeline, 8 MCP tools plus
  2 resources, 98 predicate aliases.
- Refresh MCP serving descriptions from the retired 0.3.0
  partial-serving design to the 0.4.0 inline design (ARCHITECTURE,
  serve recipe); remove references to removed get_anchors and
  get_predictions tools; fix MCP tool names in the capabilities table.
- Fix AUDN expansion to Add, Update, Delete, NOOP (matches the code
  enum; delete is a soft supersession).
- Mark docs/internal references as private-working-copy only (not
  tracked in this repo); drop untracked docs/research, docs/reviews,
  and agents entries from the ARCHITECTURE file tree.
- Remove trades from predicate examples (not canonical).

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

coderabbitai Bot commented Jul 6, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b3bc052c-b42a-4a3d-af48-12673e7546cd

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docs/tech-debt-consistency-pass

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@agulaya24 agulaya24 closed this Jul 16, 2026
@agulaya24
agulaya24 deleted the docs/tech-debt-consistency-pass branch July 16, 2026 21:59
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