test: add demotion_pressure read+write round-trip test - #7
Merged
Conversation
5 tasks
robotrocketscience
added a commit
that referenced
this pull request
Apr 27, 2026
) Synchronous, deterministic sentence classifier that assigns one of the four v1.0 belief types (factual, correction, preference, requirement) plus a source-adjusted Beta prior. Pure function, no I/O, no network. TYPE_PRIORS table ported from the previous codebase's Exp 61 work, restricted to v1.0's 4-type catalog. Non-user sources get alpha deflated by 0.2 (floored at 0.5) so scanner-extracted beliefs earn confidence through the feedback loop rather than inheriting it. Classification rules in evaluation order: 1. Empty / whitespace -> factual, persist=False 2. Question form (what/how/why/... + ?) -> factual, persist=False 3. User source + requirement keywords (must, mandatory, ...) -> requirement 4. User source + correction-detector positive -> correction 5. Preference keywords (prefer, favorite, always use, ...) -> preference 6. Default -> factual Pre-commit #7 holds: aelfrice never imports the anthropic SDK. The polymorphic onboard handshake that lets a host LLM refine these classifications lands at v0.6.0 alongside the MCP server, when there's actually a host LLM in scope. v0.5.0 ships the regex-fallback path only — the single code path used in CI / cron / no-host-agent environments. ClassificationResult.pending_classification is therefore always True in v0.5.0. 32 atomic short tests cover: TYPE_PRIORS table integrity, source-prior adjustment direction and floor, empty/whitespace short-circuit, question-form filter (positive and negative), per-rule classification across user vs non-user sources, factual default, result-object surface, determinism under repeated calls, and case insensitivity. Co-authored-by: robotrocketscience <noreply@robotrocketscience.com>
This was referenced Apr 28, 2026
robotrocketscience
added a commit
that referenced
this pull request
Apr 28, 2026
… ROADMAP split (#202) ## Summary Eight atomic doc commits resulting from a parity audit against the archived agentmemory research codebase. Splits the coarse v2.0 \`wonder\` line in ROADMAP into substrate / frontend / lifecycle tracks, cross-links 7 newly-filed parity issues (#193–#201), and lands long-overdue scope clarifications in PHILOSOPHY / LIMITATIONS / ARCHITECTURE. The audit itself lives in the private aelfrice-lab workspace; this PR contains only the public-facing doc edits derived from it. ## Commits (subject + intent) 1. \`f4faaec\` — PHILOSOPHY: import research-line scope clarifications. Resolves REQ-004, REQ-005, REQ-027, design-principle #18; introduces the Tier 1–6 \"What we can and can't guarantee\" decomposition. 2. \`9147f1f\` — LIMITATIONS: tighten Sharp edges for research-line gap parity. Cross-references core-promises #4/#6/#7 and design-principles #16/#18. 3. \`337da56\` — ROADMAP: extend recovery inventory with parked research-line capabilities. Adds five \"v1.x candidate / v2.0 candidate\" rows + new \"Deliberately not on this list\" subsection naming \`obsidian\`, \`vault_store\`, \`shared_scopes\` (the deprecate-explicitly recommendations). 4. \`c978c1d\` — ARCHITECTURE: name the research-line edge-type narrowing (17 → 6). 5. \`812e7c9\` — PHILOSOPHY: reframe exploration deferral as solution-agnostic gap (was Thompson-specific; now states the underlying filter-bubble requirement and acknowledges the gap). 6. \`1e8f458\` — PHILOSOPHY: state v1 immutable substrate is \`feedback_history\`, not observations. Cross-references \`docs/design/write-log-as-truth.md\` for the v2.0 ingest-log contract. 7. \`e01492a\` — ROADMAP: split v2.0 \`wonder\` line + add graph-traversal prep + cross-link audit issues. The single \`wonder / reason / core / unlock / delete / confirm\` row becomes 5 separate rows; new v1.5/v1.6 prep row for graph-traversal store methods. 8. \`1afdc04\` — PHILOSOPHY: declare single-axis posterior; cross-link multi-axis substrate decision (#196). ## Companion GitHub issues filed - [#193](#193) — Sentiment-from-prose feedback (v2.0 evaluation) - [#194](#194) — \`ingest_turn(bulk=)\` parameter (v2.0 wonder prep) - [#195](#195) — \`scoring.uncertainty_score\` (v2.0 wonder prep, post-substrate-decision) - [#196](#196) — v2.0 substrate decision: multi-axis vs single-axis uncertainty (load-bearing) - [#197](#197) — Deduplication module (v2.0 evaluation) - [#198](#198) — Multi-LLM consensus module (v2.0 evaluation) - [#199](#199) — Enforcement module: directive detection + compliance audit + selective injection - [#201](#201) — Semantic contradiction detector (v2.0 evaluation) ## Test plan - [ ] \`docs/ROADMAP.md\` recovery inventory parses as a valid markdown table; all issue links resolve. - [ ] \`docs/PHILOSOPHY.md\` renders cleanly (no broken cross-refs to \`design/write-log-as-truth.md\`). - [ ] \`docs/LIMITATIONS.md\` Sharp edges section reads coherently with the new bullets in context. - [ ] commit-msg-prefix CI job passes (all 8 commits use \`docs:\` or \`docs(scope):\` prefix). - [ ] PR-body issue-link advisory check passes (this PR body contains issue references). <!-- no-issue -->
robotrocketscience
added a commit
that referenced
this pull request
May 9, 2026
…dy for PR
Closes the mcp-builder audit of src/aelfrice/mcp_server.py started this
session. Resolves both CRITICAL findings, all six MAJOR findings, and
five of the eight MINOR findings. The deferred minors are documented
in this gate body for triage in follow-up issues.
## Commits in scope (10 atomic + 1 phase-1 gate before this)
Phase 1 — server is startable and discoverable
9adca85 feat(mcp): aelf mcp subcommand + python -m fallback
904bfb0 feat(mcp): docstrings on all 12 wrappers + AST regression guard
455eaac docs(mcp): document `aelf mcp` entrypoint + fix stale refs
46df710 gate: phase 1
Phase 2 — well-formed
a7576ad feat(mcp): annotations on every @mcp.tool
232d8ab feat(mcp): instructions= overview + 9-vs-12 stale comment fix
5f21c29 fix(mcp): tool_lock structured error vs AssertionError
Phase 3 — input/output discipline
6c6bf6c feat(mcp): Pydantic Field constraints via Annotated
174d245 feat(mcp): cursor pagination on tool_locked
7f04675 feat(mcp): response_format=markdown on read tools
Phase 4 — wrapper-layer testing
0214c17 test(mcp): wrapper-layer tests via static AST + fastmcp shim
## Verification
- pytest 76/76 passing across MCP test files (40 prior + 36 new):
test_mcp_server.py, test_mcp_lock_via_worker.py,
test_mcp_wrapper_layer.py, test_cli_mcp.py
- aelf --help: 'mcp' subcommand visible with help string
- aelf mcp (no [mcp] extra): exits 1 with actionable stderr
- Static AST guards: docstrings, annotations, instructions=, store
lifetime, no print()-to-stdout, all green
- fastmcp shim test: 12 tools register, all with full annotations,
read-only / destructive sets match expected
- Discretion grep: clean (only mentions Claude Code/Desktop, both
pre-existing on main as the intended MCP host targets)
## Audit findings closure
CRITICAL #1 Server unstartable → CLOSED (Phase 1 C1)
CRITICAL #2 Empty tool descriptions → CLOSED (Phase 1 C2)
MAJOR #3 No tool annotations → CLOSED (Phase 2 M1)
MAJOR #4 No Pydantic input validation → CLOSED (Phase 3 I1)
MAJOR #5 No server instructions= → CLOSED (Phase 2 M2)
MAJOR #6 No README/docs MCP setup section → CLOSED (Phase 1 C3)
MAJOR #7 Registration layer untested → CLOSED (Phase 4)
MAJOR #8 tool_lock hard assert → CLOSED (Phase 2 M4)
MINOR #11 No response_format enum → CLOSED (Phase 3 I2)
MINOR #12 No pagination on aelf_locked → CLOSED (Phase 3 I3)
MINOR #13 Stale 9-vs-12 tools comment → CLOSED (Phase 2 M3)
## Deferred (file follow-up issues)
MINOR #1 Server name "aelfrice" vs convention "aelfrice_mcp"
— backwards-compat break, not load-bearing. Defer.
MINOR #6 Sync handlers (no async def) — defensible for SQLite,
revisit if/when an async I/O dep lands.
MINOR #14 Polymorphic tool_onboard (3 input shapes in one tool)
— design call. Re-evaluate after host telemetry.
MINOR #15 Untyped fastmcp cast `_FastMCP: Any` — fastmcp lacks
stubs upstream. Pragmatic; revisit when stubs ship.
## Behavior changes worth flagging in PR description
- `tool_locked` return shape: ADDED keys total/has_more/next_offset.
Existing keys (kind/n/locked) preserved. Callers that consumed
`n` as "total locks across all locks" should switch to `total`.
- `tool_locked` returns first 50 by default instead of all locks. Tests
on stores with <50 locks behave identically.
- `tool_lock` returns lock.error dict (with `error` field) instead of
raising AssertionError on empty derivation. Callers that grep for
AssertionError need to update; callers that check `out["kind"]` are
fine.
## Blockers (require user decision before next phase)
- [user] Open PR? Branch is local-only on `feat/mcp-server-properly-built`.
Need a `git push -u github feat/mcp-server-properly-built` to land it,
then `gh pr create`. Not done by this gate.
- [user] File the four deferred-minor follow-up issues now or after
PR merge?
- [user] Resume parked feat/aelf-upgrade-imperative work next session?
That branch has no commits but the worktree state is captured in the
end-of-session handoff.
Open questions: (none)
Rollback:
- Whole branch: never merged → just delete `feat/mcp-server-properly-built`.
- Per-phase: `git revert <phase-commit-range>` (see commit list above).
robotrocketscience
added a commit
that referenced
this pull request
May 9, 2026
…dy for PR
Closes the mcp-builder audit of src/aelfrice/mcp_server.py started this
session. Resolves both CRITICAL findings, all six MAJOR findings, and
five of the eight MINOR findings. The deferred minors are documented
in this gate body for triage in follow-up issues.
## Commits in scope (10 atomic + 1 phase-1 gate before this)
Phase 1 — server is startable and discoverable
9adca85 feat(mcp): aelf mcp subcommand + python -m fallback
904bfb0 feat(mcp): docstrings on all 12 wrappers + AST regression guard
455eaac docs(mcp): document `aelf mcp` entrypoint + fix stale refs
46df710 gate: phase 1
Phase 2 — well-formed
a7576ad feat(mcp): annotations on every @mcp.tool
232d8ab feat(mcp): instructions= overview + 9-vs-12 stale comment fix
5f21c29 fix(mcp): tool_lock structured error vs AssertionError
Phase 3 — input/output discipline
6c6bf6c feat(mcp): Pydantic Field constraints via Annotated
174d245 feat(mcp): cursor pagination on tool_locked
7f04675 feat(mcp): response_format=markdown on read tools
Phase 4 — wrapper-layer testing
0214c17 test(mcp): wrapper-layer tests via static AST + fastmcp shim
## Verification
- pytest 76/76 passing across MCP test files (40 prior + 36 new):
test_mcp_server.py, test_mcp_lock_via_worker.py,
test_mcp_wrapper_layer.py, test_cli_mcp.py
- aelf --help: 'mcp' subcommand visible with help string
- aelf mcp (no [mcp] extra): exits 1 with actionable stderr
- Static AST guards: docstrings, annotations, instructions=, store
lifetime, no print()-to-stdout, all green
- fastmcp shim test: 12 tools register, all with full annotations,
read-only / destructive sets match expected
- Discretion grep: clean (only mentions Claude Code/Desktop, both
pre-existing on main as the intended MCP host targets)
## Audit findings closure
CRITICAL #1 Server unstartable → CLOSED (Phase 1 C1)
CRITICAL #2 Empty tool descriptions → CLOSED (Phase 1 C2)
MAJOR #3 No tool annotations → CLOSED (Phase 2 M1)
MAJOR #4 No Pydantic input validation → CLOSED (Phase 3 I1)
MAJOR #5 No server instructions= → CLOSED (Phase 2 M2)
MAJOR #6 No README/docs MCP setup section → CLOSED (Phase 1 C3)
MAJOR #7 Registration layer untested → CLOSED (Phase 4)
MAJOR #8 tool_lock hard assert → CLOSED (Phase 2 M4)
MINOR #11 No response_format enum → CLOSED (Phase 3 I2)
MINOR #12 No pagination on aelf_locked → CLOSED (Phase 3 I3)
MINOR #13 Stale 9-vs-12 tools comment → CLOSED (Phase 2 M3)
## Deferred (file follow-up issues)
MINOR #1 Server name "aelfrice" vs convention "aelfrice_mcp"
— backwards-compat break, not load-bearing. Defer.
MINOR #6 Sync handlers (no async def) — defensible for SQLite,
revisit if/when an async I/O dep lands.
MINOR #14 Polymorphic tool_onboard (3 input shapes in one tool)
— design call. Re-evaluate after host telemetry.
MINOR #15 Untyped fastmcp cast `_FastMCP: Any` — fastmcp lacks
stubs upstream. Pragmatic; revisit when stubs ship.
## Behavior changes worth flagging in PR description
- `tool_locked` return shape: ADDED keys total/has_more/next_offset.
Existing keys (kind/n/locked) preserved. Callers that consumed
`n` as "total locks across all locks" should switch to `total`.
- `tool_locked` returns first 50 by default instead of all locks. Tests
on stores with <50 locks behave identically.
- `tool_lock` returns lock.error dict (with `error` field) instead of
raising AssertionError on empty derivation. Callers that grep for
AssertionError need to update; callers that check `out["kind"]` are
fine.
## Blockers (require user decision before next phase)
- [user] Open PR? Branch is local-only on `feat/mcp-server-properly-built`.
Need a `git push -u github feat/mcp-server-properly-built` to land it,
then `gh pr create`. Not done by this gate.
- [user] File the four deferred-minor follow-up issues now or after
PR merge?
- [user] Resume parked feat/aelf-upgrade-imperative work next session?
That branch has no commits but the worktree state is captured in the
end-of-session handoff.
Open questions: (none)
Rollback:
- Whole branch: never merged → just delete `feat/mcp-server-properly-built`.
- Per-phase: `git revert <phase-commit-range>` (see commit list above).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Locks in that demotion_pressure is both written and readable end-to-end. Insert with explicit values, update, read back assertions.
Test plan