Add procedural memory layer#94
Conversation
|
Review of split #1 (procedural memory layer). Structure ✅Clean isolation from #95/#96. Scope matches title and body:
Migration doc — genuinely good ✅Read
Spot-checked: Open items
Otherwise this is the cleanest split of the three and ready for line-by-line review once CI is unblocked. Nice work. |
|
CI approved and ran — immediately failed in DiagnosisInspecting the PR tree, the two
This is a known Windows+git gotcha — usually triggered by FixFrom any platform, on the git checkout codex/procedural-memory-layer
# Overwrite db/init_schema.sql with the actual file content and force git to
# treat it as a regular file, not a symlink.
git cat-file blob HEAD:src/agentmemory/db/init_schema.sql > db/init_schema.sql
git update-index --chmod=-x db/init_schema.sql
git add db/init_schema.sql
git commit --amend --no-edit
git push --force-with-leaseIf that doesn't flip the mode, the blunt version: git rm --cached db/init_schema.sql
git cat-file blob HEAD:src/agentmemory/db/init_schema.sql > db/init_schema.sql
git add db/init_schema.sql
git commit --amend --no-edit
git push --force-with-leaseAfter re-push, verify with: git ls-tree HEAD db/init_schema.sqlYou want the leading mode to read AlsoWhile you're in the fixer branch, consider adding to your Windows dev loop: at least in this repo's clone — brainctl maintains the dual Status of the other splitsFor visibility: CI approved on all four of your PRs this round. #95 and #96 are currently |
|
Addressed the open review items from this comment. Version bumpI did not bump MCP tool inventoryI added a
Current statusNo code change was needed for this pass. The branch is still clean and pushed at |
|
Fixed the checkout blocker from this comment. What changedPushed commit The only change is the git file mode for The blob/content hash remains identical to So this should remove the Linux checkout failure without changing schema content. Local preventionI also set this clone's local config to avoid recreating the issue on Windows: git config core.symlinks falseValidationpython -m pytest tests\test_schema_parity.py tests\test_migrate.py -qResult: This should let CI get past |
|
Correction on my earlier guidance — I owe you an apology. My previous comment told you to flip The symlink itself is correct and intentional — it's the drift-prevention mechanism between the two The real fix
The git blob for that symlink should be ~36 bytes (just the target path string), not 79 KB. On macOS/Linuxgit checkout codex/procedural-memory-layer
cd db
rm init_schema.sql
ln -s ../src/agentmemory/db/init_schema.sql init_schema.sql
cd ..
git add db/init_schema.sql
git commit --amend --no-edit
git push --force-with-leaseOn Windows (which is why it broke originally) — use git plumbing to avoid OS filesystem symlink semantics# Keep this on in your clone
git config core.symlinks true
# Create a blob whose content is just the relative path string
BLOB=$(printf "../src/agentmemory/db/init_schema.sql" | git hash-object -w --stdin)
echo "blob: $BLOB" # should be ~40-char sha, blob size ~36 bytes
# Stage it as a symlink (git mode 120000)
git rm --cached db/init_schema.sql 2>/dev/null || true
git update-index --add --cacheinfo 120000,$BLOB,db/init_schema.sql
git commit --amend --no-edit
git push --force-with-leaseVerifygit ls-tree HEAD db/init_schema.sql
# Expect: 120000 blob <sha> db/init_schema.sql
git cat-file -p HEAD:db/init_schema.sql
# Expect exactly: ../src/agentmemory/db/init_schema.sqlThe other two failures in this run
Sorry for the misdirection on the symlink. Restoring it should unblock most of this. |
|
Addressed the latest #94 feedback. Changes pushed to
Validation run locally: python -m pytest tests/test_docs_check.py tests/test_cli.py::TestCLISearch::test_search_includes_procedures_bucket -q
# 2 passed
python -m py_compile scripts\check_docs.py src\agentmemory\_impl.py src\agentmemory\procedural.py src\agentmemory\commands\procedure.py src\agentmemory\mcp_tools_procedural.pyNote: I verified the symlink via git object mode/blob content rather than |
v2.7.0: procedural memory layer (Velamj's PR #94, rebased onto current main)
) Lands PR TSchonleber#94 "Add procedural memory layer" by Mario Jack Vela (Velamj). +3960/-101 across 18 files. 70 procedural tests + a full-suite check (2225 passed) green in a fresh-venv CI mirror. Original PR TSchonleber#94 history (these 5 commits are squashed here because commit a11c19e accidentally replaced the db/init_schema.sql symlink with a regular file containing the full schema content, which fails `git apply` with "File name too long" — commits 3+4 fixed the symlink, but the broken intermediate state can't live in main's history. The PR itself stays on GitHub for full per-commit provenance): 54ca416 2026-04-24 Fix procedural search and docs drift 7ce7bb8 2026-04-24 Restore init schema symlink target e11db77 2026-04-24 Fix init schema file mode 013d1dd 2026-04-24 Clarify procedural migration compatibility a11c19e 2026-04-24 Add procedural memory layer What lands: * New first-class memory_type 'procedural' alongside 'episodic' and 'semantic'. Tulving 1972's tripartite memory typology in code. * Migration 052 (db/migrations/052_procedural_memory_layer.sql) — canonical procedure tables (procedures, procedure_steps, procedure_sources) + FTS5 virtual table for procedure_search. Migration starts with PRAGMA foreign_keys=OFF inside a BEGIN/COMMIT envelope; runner only records schema_versions after the SQL script completes; legacy episodic/semantic reads + writes stay expected to work. * Procedural service layer (src/agentmemory/procedural.py, +1679 LOC) — Brain API methods + canonical CRUD + FTS-backed search. * CLI surface: `brainctl procedure add/get/list/search/update/ feedback/backfill/stats` via src/agentmemory/commands/procedure.py. * 8 new MCP tools (now 209 total, was 201): procedure_add / procedure_get / procedure_list / procedure_search / procedure_update / procedure_feedback / procedure_backfill / procedure_stats. MCP_SERVER.md + scripts/check_docs.py asserts updated for the new count. * Bridge synopsis rows kept in memories so legacy memory search still surfaces procedures by their text content. * docs/PROCEDURAL_MEMORY_MIGRATION.md documents transaction safety, backward-compat expectations, rollback / failure behavior, versioning notes, and fresh-install parity requirements. Why this is shipping now: brainctl had this primitive 19 days before any of the public competing implementations (ainl-cortex pushed May 12, 2026; this PR opened April 24, 2026). Shipping it as the headline v2.7.0 feature alongside the marketplace + token launch. Closes TSchonleber#94. Co-Authored-By: Mario Jack Vela <mjvelamd86@gmail.com>
CHANGELOG entry credits Velamj (PR TSchonleber#94, 2026-04-24) as the contributor + headlines v2.7.0 around procedural memory. Provenance note locked: this primitive predates ainl-cortex (2026-05-12) by 19 days.
Summary
Split PR 1 from the broad procedural/retrieval benchmark draft (#93).
This PR adds the first-class procedural memory layer only:
memories.memory_typeto supportprocedural;procedurecommands, and MCP procedural tools;memoriesso legacy memory search still has a synopsis;docs/PROCEDURAL_MEMORY_MIGRATION.md.Generated benchmark result bundles, retrieval reranker changes, and benchmark comparison harness changes are intentionally not included in this split PR.
Validation
Ran locally on Windows PowerShell:
Results:
70 passed;51 passed.Migration Notes
See
docs/PROCEDURAL_MEMORY_MIGRATION.mdfor transaction safety, backward-compat expectations, rollback/failure behavior, versioning notes, and fresh-install parity requirements.Follow-up clarification commit
013d1ddmade the transaction and compatibility boundary explicit:PRAGMA foreign_keys = OFF; BEGIN;and only re-enables FKs afterCOMMIT;;schema_versionsonly after the SQL script completes;Versioning
This PR intentionally does not bump
pyproject.tomlby itself. The version bump should land in the release/integration PR that decides the final bundle of procedural memory plus any coordinated retrieval changes. The compatibility note indocs/PROCEDURAL_MEMORY_MIGRATION.mdis the required release-note content for that bump.New MCP Tools
procedure_add: create a structured procedure and bridge memory synopsis.procedure_get: fetch one procedure by ID, including steps/sources when available.procedure_list: list procedures by status/scope with pagination limit.procedure_search: FTS-backed procedure search with optional debug diagnostics.procedure_update: update structured procedure metadata/JSON fields.procedure_feedback: record execution outcome and update procedure quality counters/status.procedure_backfill: deterministic free-text/workflow backfill into procedure candidates or procedures.procedure_stats: aggregate procedure counts/status/usage metrics.