mempalace-code 1.1.0__tar.gz → 1.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (135) hide show
  1. mempalace_code-1.2.0/.claude/prompts/codex-hardening-review.md +48 -0
  2. mempalace_code-1.2.0/.claude/prompts/codex-plan-review.md +45 -0
  3. mempalace_code-1.2.0/.claude/settings.json +73 -0
  4. mempalace_code-1.2.0/.claude/skills/_shared/commit-checkpoint.md +121 -0
  5. mempalace_code-1.2.0/.claude/skills/_shared/mode-classification.md +25 -0
  6. mempalace_code-1.2.0/.claude/skills/_shared/task-state.md +83 -0
  7. mempalace_code-1.2.0/.claude/skills/bench/SKILL.md +113 -0
  8. mempalace_code-1.2.0/.claude/skills/doc-refresh/INSTRUCTIONS.md +118 -0
  9. mempalace_code-1.2.0/.claude/skills/doc-refresh/SKILL.md +10 -0
  10. mempalace_code-1.2.0/.claude/skills/entropy-gc/INSTRUCTIONS.md +164 -0
  11. mempalace_code-1.2.0/.claude/skills/entropy-gc/SKILL.md +10 -0
  12. mempalace_code-1.2.0/.claude/skills/mine/SKILL.md +110 -0
  13. mempalace_code-1.2.0/.claude/skills/palace-health/SKILL.md +85 -0
  14. mempalace_code-1.2.0/.claude/skills/release/SKILL.md +128 -0
  15. mempalace_code-1.2.0/.claude/skills/ship/INSTRUCTIONS.md +58 -0
  16. mempalace_code-1.2.0/.claude/skills/ship/SKILL.md +9 -0
  17. mempalace_code-1.2.0/.claude/skills/start/INSTRUCTIONS.md +63 -0
  18. mempalace_code-1.2.0/.claude/skills/start/SKILL.md +9 -0
  19. mempalace_code-1.2.0/.claude/skills/status/SKILL.md +45 -0
  20. mempalace_code-1.2.0/.claude/skills/task-hardening/INSTRUCTIONS.md +102 -0
  21. mempalace_code-1.2.0/.claude/skills/task-hardening/SKILL.md +10 -0
  22. mempalace_code-1.2.0/.claude/skills/task-plan/INSTRUCTIONS.md +115 -0
  23. mempalace_code-1.2.0/.claude/skills/task-plan/SKILL.md +10 -0
  24. mempalace_code-1.2.0/.claude/skills/verify/INSTRUCTIONS.md +118 -0
  25. mempalace_code-1.2.0/.claude/skills/verify/SKILL.md +9 -0
  26. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/.github/workflows/ci.yml +10 -0
  27. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/.gitignore +5 -2
  28. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/CHANGELOG.md +48 -0
  29. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/CLAUDE.md +3 -2
  30. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/PKG-INFO +133 -19
  31. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/README.md +125 -12
  32. mempalace_code-1.2.0/benchmarks/dotnet_bench.py +473 -0
  33. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/docs/AGENT_INSTALL.md +34 -0
  34. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/docs/BACKLOG.yaml +523 -290
  35. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/docs/BACKUP_RESTORE.md +52 -1
  36. mempalace_code-1.2.0/mempalace/backup.py +434 -0
  37. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/mempalace/cli.py +266 -11
  38. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/mempalace/config.py +46 -0
  39. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/mempalace/convo_miner.py +22 -4
  40. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/mempalace/knowledge_graph.py +16 -0
  41. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/mempalace/mcp_server.py +27 -12
  42. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/mempalace/miner.py +1069 -24
  43. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/mempalace/searcher.py +13 -0
  44. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/mempalace/storage.py +252 -5
  45. mempalace_code-1.2.0/mempalace/version.py +12 -0
  46. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/pyproject.toml +8 -7
  47. mempalace_code-1.2.0/scripts/codex-review.sh +456 -0
  48. mempalace_code-1.2.0/tests/test_backup.py +509 -0
  49. mempalace_code-1.2.0/tests/test_chroma_compat.py +46 -0
  50. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/tests/test_chunking.py +342 -0
  51. mempalace_code-1.2.0/tests/test_cli.py +534 -0
  52. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/tests/test_convo_miner.py +33 -1
  53. mempalace_code-1.2.0/tests/test_dotnet_config.py +1 -0
  54. mempalace_code-1.2.0/tests/test_kg_extract.py +1214 -0
  55. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/tests/test_lang_detect.py +62 -1
  56. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/tests/test_mcp_server.py +150 -0
  57. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/tests/test_migrate.py +25 -0
  58. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/tests/test_miner.py +457 -1
  59. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/tests/test_storage.py +426 -13
  60. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/tests/test_storage_lance.py +48 -0
  61. mempalace_code-1.2.0/tests/test_symbol_extract.py +1160 -0
  62. mempalace_code-1.1.0/mempalace/backup.py +0 -222
  63. mempalace_code-1.1.0/mempalace/version.py +0 -3
  64. mempalace_code-1.1.0/tests/test_backup.py +0 -197
  65. mempalace_code-1.1.0/tests/test_cli.py +0 -171
  66. mempalace_code-1.1.0/tests/test_symbol_extract.py +0 -498
  67. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
  68. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
  69. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
  70. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/.github/workflows/publish.yml +0 -0
  71. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/.pre-commit-config.yaml +0 -0
  72. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/CONTRIBUTING.md +0 -0
  73. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/LICENSE +0 -0
  74. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/NOTICE +0 -0
  75. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/assets/mempalace_banner.jpg +0 -0
  76. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/benchmarks/BENCHMARKS.md +0 -0
  77. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/benchmarks/HYBRID_MODE.md +0 -0
  78. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/benchmarks/README.md +0 -0
  79. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/benchmarks/convomem_bench.py +0 -0
  80. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/benchmarks/embed_ab_bench.py +0 -0
  81. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/benchmarks/locomo_bench.py +0 -0
  82. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/benchmarks/longmemeval_bench.py +0 -0
  83. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/benchmarks/membench_bench.py +0 -0
  84. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/benchmarks/results_embed_ab_2026-04-09.json +0 -0
  85. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/benchmarks/results_token_delta_mempalace.json +0 -0
  86. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/benchmarks/token_delta_bench.py +0 -0
  87. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/docs/BENCH_TOKEN_DELTA.md +0 -0
  88. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/docs/COMPARISON_GRAPHIFY.md +0 -0
  89. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/docs/HOW_SEARCH_WORKS.md +0 -0
  90. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/docs/OFFLINE_USAGE.md +0 -0
  91. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/docs/UPSTREAM_HARDENING.md +0 -0
  92. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/docs/WHY_THIS_FORK.md +0 -0
  93. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/examples/HOOKS_TUTORIAL.md +0 -0
  94. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/examples/basic_mining.py +0 -0
  95. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/examples/convo_import.py +0 -0
  96. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/examples/gemini_cli_setup.md +0 -0
  97. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/examples/mcp_setup.md +0 -0
  98. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/hooks/README.md +0 -0
  99. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/hooks/mempal_precompact_hook.sh +0 -0
  100. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/hooks/mempal_save_hook.sh +0 -0
  101. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/mempalace/README.md +0 -0
  102. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/mempalace/__init__.py +0 -0
  103. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/mempalace/__main__.py +0 -0
  104. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/mempalace/_chroma_store.py +0 -0
  105. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/mempalace/dialect.py +0 -0
  106. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/mempalace/entity_detector.py +0 -0
  107. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/mempalace/entity_registry.py +0 -0
  108. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/mempalace/export.py +0 -0
  109. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/mempalace/general_extractor.py +0 -0
  110. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/mempalace/layers.py +0 -0
  111. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/mempalace/migrate.py +0 -0
  112. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/mempalace/normalize.py +0 -0
  113. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/mempalace/onboarding.py +0 -0
  114. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/mempalace/palace_graph.py +0 -0
  115. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/mempalace/py.typed +0 -0
  116. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/mempalace/room_detector_local.py +0 -0
  117. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/mempalace/spellcheck.py +0 -0
  118. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/mempalace/split_mega_files.py +0 -0
  119. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/mempalace/treesitter.py +0 -0
  120. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/scripts/bootstrap.sh +0 -0
  121. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/scripts/nuke_wing.py +0 -0
  122. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/tests/conftest.py +0 -0
  123. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/tests/test_config.py +0 -0
  124. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/tests/test_dialect.py +0 -0
  125. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/tests/test_e2e.py +0 -0
  126. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/tests/test_embed_ab_bench.py +0 -0
  127. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/tests/test_export.py +0 -0
  128. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/tests/test_knowledge_graph.py +0 -0
  129. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/tests/test_normalize.py +0 -0
  130. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/tests/test_offline.py +0 -0
  131. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/tests/test_searcher.py +0 -0
  132. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/tests/test_split_mega_files.py +0 -0
  133. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/tests/test_treesitter.py +0 -0
  134. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/tests/test_version_consistency.py +0 -0
  135. {mempalace_code-1.1.0 → mempalace_code-1.2.0}/uv.lock +0 -0
@@ -0,0 +1,48 @@
1
+ Round __ROUND__: targeted Codex verification for feature "__FEATURE_NAME__" in "__FEATURE_SCOPE__".
2
+
3
+ Task slug: __TASK_SLUG__
4
+ Evidence output path: __OUTPUT_FILE__
5
+ Scope source: __SCOPE_SOURCE__
6
+ Scoped diff artifact: __SCOPED_DIFF_FILE__
7
+ Scoped files manifest: __SCOPED_FILES_FILE__
8
+
9
+ Goal:
10
+ Find high-impact issues in the task-scoped diff without modifying files.
11
+ Prioritize signal over volume.
12
+
13
+ Scope discipline:
14
+ - Read first:
15
+ 1. scoped diff artifact: `__SCOPED_DIFF_FILE__`
16
+ 2. scoped files manifest: `__SCOPED_FILES_FILE__`
17
+ 3. previous round report: `docs/audits/__TASK_SLUG__-round-__PREVIOUS_ROUND__.md` if it exists
18
+ 4. backlog context: __KNOWN_ISSUES_SCOPE__
19
+ - Treat the scoped diff artifact and scoped files manifest as authoritative for this review.
20
+ - This review runs in an isolated snapshot that mirrors only scoped files and task-local context. Ignore unrelated repo changes outside that scope.
21
+ - __ROUND_FOCUS__
22
+ - Stay inside "__FEATURE_SCOPE__" and directly affected dependencies.
23
+ - Start from the scoped diff and expand only to code paths it can realistically break.
24
+ - Do NOT scan unrelated repo areas or turn this into repo-wide cleanup.
25
+
26
+ Review bar:
27
+ - Report only concrete, current, bounded issues.
28
+ - Prioritize user-visible breakage, data/security issues, contract drift, race conditions, and missing regression tests on bug-prone touched paths.
29
+ - Do not report formatting, naming, cleanup-only refactors, speculative guards, weak polish nits, or pre-existing out-of-scope issues unless they are P0/P1 or directly causal.
30
+ - Zero findings is normal.
31
+
32
+ Output format:
33
+ 1. New Findings
34
+ 2. Known Issues Map Status
35
+ 3. Evidence Reviewed
36
+ 4. Residual Risks
37
+ 5. Convergence Recommendation
38
+ 6. Suggested Claude Follow-Up
39
+
40
+ Rules:
41
+ - Search strategy: use `rg -l` (list matching files) first to identify
42
+ relevant files, then read or search within specific files. Never run
43
+ unbounded content searches across broad directory trees.
44
+ - At most 3 findings unless the feature is clearly unstable.
45
+ - Include severity (`P0`-`P3`), confidence (`High` / `Medium` / `Low`), and file:line for each surviving finding.
46
+ - Suppress duplicate findings using the previous audit and matching backlog items.
47
+ - Keep findings concise and high-signal.
48
+ - Do not edit files. Claude will act on your report.
@@ -0,0 +1,45 @@
1
+ You are an independent second-pass reviewer for planning artifacts in this repository.
2
+
3
+ Task slug: __TASK_SLUG__
4
+ Plan file under review: __PLAN_FILE__
5
+ Evidence output path: __OUTPUT_FILE__
6
+
7
+ Goal:
8
+ Review the current implementation plan for execution readiness before coding begins.
9
+ Do not modify repository files. Produce a concise report that Claude can act on.
10
+
11
+ Required workflow:
12
+ 1. Read `AGENTS.md`, `CLAUDE.md`, `.memory-bank/README.md`, and `__PLAN_FILE__`.
13
+ 2. Read the smallest relevant canonical docs/rules/templates referenced by the plan.
14
+ 3. Use semantic navigation tools first for symbol lookups when available (`definition`, `references`, `hover`). Use grep/read for string searches, markdown, shell, JSON, or when semantic tools are unavailable.
15
+ 4. Search the codebase for affected files, existing patterns, accepted dependencies, prior plans, and relevant subsystem boundaries before judging the plan.
16
+ 5. Use repository evidence first. Do not rely on unsupported assumptions.
17
+ 6. Stay scoped to this task. Do not turn this into repo-wide cleanup.
18
+
19
+ Check for:
20
+ - missing affected files or subsystems
21
+ - missing schema/data, backend, frontend, API, state, auth, cache/event, docs, or cleanup work
22
+ - blockers hidden as `TBD`, "investigate later", or deferred design work
23
+ - acceptance criteria that are not observable
24
+ - verification map gaps or manual-only verification for behavior changes
25
+ - conflicts with architecture, repo rules, or accepted patterns
26
+ - unnecessary complexity or unjustified new dependencies
27
+ - assumptions that should be called out explicitly
28
+
29
+ Output format:
30
+ 1. Verdict: `READY` or `NEEDS_CHANGES`
31
+ 2. Critical Gaps
32
+ 3. Non-blocking Improvements
33
+ 4. Missing Evidence To Gather
34
+ 5. Suggested Plan Deltas
35
+ 6. Blocking Open Questions
36
+ 7. Recommended Next Step
37
+
38
+ Rules:
39
+ - Search strategy: use `rg -l` (list matching files) first to identify
40
+ relevant files, then read or search within specific files. Never run
41
+ unbounded content searches across broad directory trees.
42
+ - Report only evidence-backed issues.
43
+ - Prefer no finding over weak finding.
44
+ - If no blocking issues remain, say so explicitly.
45
+ - Do not edit files.
@@ -0,0 +1,73 @@
1
+ {
2
+ "hooks": {
3
+ "PreToolUse": [
4
+ {
5
+ "matcher": "Bash",
6
+ "hooks": [
7
+ {
8
+ "type": "command",
9
+ "command": "if echo \"$CLAUDE_TOOL_INPUT\" | grep -qE 'git commit'; then echo '[pre-commit] Running verify gate...'; _s=$(mktemp); _u=$(mktemp); git diff --name-only --cached | sort >\"$_s\"; git diff --name-only | sort >\"$_u\"; MIXED=$(comm -12 \"$_s\" \"$_u\"); rm -f \"$_s\" \"$_u\"; if [ -n \"$MIXED\" ]; then echo '[warn] Staged files have unstaged changes (CI will not see them):'; echo \"$MIXED\" | sed 's/^/ /'; echo ''; fi; _tf=$(mktemp); if python -m pytest tests/ -x -q >\"$_tf\" 2>&1; then echo '[ok] pytest passed'; rm -f \"$_tf\"; else echo '[fail] pytest failed:'; tail -40 \"$_tf\"; rm -f \"$_tf\"; exit 1; fi; _tf=$(mktemp); if ruff check mempalace/ tests/ >\"$_tf\" 2>&1; then echo '[ok] ruff check passed'; rm -f \"$_tf\"; else echo '[fail] ruff check failed:'; cat \"$_tf\"; rm -f \"$_tf\"; exit 1; fi; _tf=$(mktemp); if ruff format --check mempalace/ tests/ >\"$_tf\" 2>&1; then echo '[ok] ruff format passed'; rm -f \"$_tf\"; else echo '[fail] ruff format failed:'; cat \"$_tf\"; rm -f \"$_tf\"; exit 1; fi; if git diff --name-only --cached | grep -q 'BACKLOG.yaml'; then if ! backlog validate --file docs/BACKLOG.yaml >/dev/null 2>&1; then echo '[fail] backlog validate failed'; exit 1; else echo '[ok] backlog validate passed'; fi; fi; fi",
10
+ "timeout": 300000
11
+ },
12
+ {
13
+ "type": "command",
14
+ "command": "if echo \"$CLAUDE_TOOL_INPUT\" | grep -qE 'git commit'; then if git diff --name-only --cached | grep -qE '^mempalace/mcp_server\\.py$' && ! git diff --name-only --cached | grep -qE '^docs/AGENT_INSTALL\\.md$'; then echo '[warn] MCP server changed without AGENT_INSTALL.md update'; fi; fi",
15
+ "timeout": 5000
16
+ },
17
+ {
18
+ "type": "command",
19
+ "command": "if echo \"$CLAUDE_TOOL_INPUT\" | grep -qE 'git commit'; then if git diff --name-only --cached | grep -qE '^mempalace/storage\\.py$' && ! git diff --name-only --cached | grep -qE '^docs/STORAGE\\.md$'; then echo '[warn] storage.py changed without STORAGE.md update'; fi; fi",
20
+ "timeout": 5000
21
+ }
22
+ ]
23
+ }
24
+ ],
25
+ "PostToolUse": [
26
+ {
27
+ "matcher": "Edit|Write",
28
+ "hooks": [
29
+ {
30
+ "type": "command",
31
+ "command": "FILE=$(echo \"$CLAUDE_TOOL_INPUT\" | grep -oE '\"file_path\"[[:space:]]*:[[:space:]]*\"[^\"]+\"' | head -1 | sed 's/.*\"\\([^\"]*\\)\"$/\\1/'); if [ -n \"$FILE\" ]; then echo \"[$(date +%H:%M:%S)] Modified: $FILE\" >> /tmp/claude-edits.log 2>/dev/null || true; fi",
32
+ "timeout": 5000
33
+ },
34
+ {
35
+ "type": "command",
36
+ "command": "if echo \"$CLAUDE_TOOL_INPUT\" | grep -qE 'BACKLOG\\.yaml'; then backlog validate --file docs/BACKLOG.yaml 2>&1 || true; fi",
37
+ "timeout": 10000
38
+ },
39
+ {
40
+ "type": "command",
41
+ "command": "if echo \"$CLAUDE_TOOL_INPUT\" | grep -qE 'mempalace/mcp_server\\.py'; then echo '[info] MCP server edited - update docs/AGENT_INSTALL.md if tool signatures changed'; fi",
42
+ "timeout": 5000
43
+ },
44
+ {
45
+ "type": "command",
46
+ "command": "if echo \"$CLAUDE_TOOL_INPUT\" | grep -qE 'mempalace/storage\\.py'; then echo '[info] storage.py edited - run tests: python -m pytest tests/test_storage.py -v'; fi",
47
+ "timeout": 5000
48
+ },
49
+ {
50
+ "type": "command",
51
+ "command": "if echo \"$CLAUDE_TOOL_INPUT\" | grep -qE 'mempalace/miner\\.py'; then echo '[info] miner.py edited - run tests: python -m pytest tests/test_miner.py -v'; fi",
52
+ "timeout": 5000
53
+ },
54
+ {
55
+ "type": "command",
56
+ "command": "if echo \"$CLAUDE_TOOL_INPUT\" | grep -qE 'mempalace/lang_detect\\.py|mempalace/chunker\\.py'; then echo '[info] Language support edited - run: python -m pytest tests/test_lang_detect.py tests/test_chunker.py -v'; fi",
57
+ "timeout": 5000
58
+ }
59
+ ]
60
+ },
61
+ {
62
+ "matcher": "Bash",
63
+ "hooks": [
64
+ {
65
+ "type": "command",
66
+ "command": "if echo \"$CLAUDE_TOOL_INPUT\" | grep -qE 'mempalace (mine|health|repair|restore)'; then if echo \"$CLAUDE_TOOL_OUTPUT\" 2>/dev/null | grep -qiE 'error|fail|corrupt|missing'; then echo '[alert] Palace operation may have failed - consider running /palace-health'; fi; fi",
67
+ "timeout": 5000
68
+ }
69
+ ]
70
+ }
71
+ ]
72
+ }
73
+ }
@@ -0,0 +1,121 @@
1
+ # Commit Checkpoint — Shared Procedure
2
+
3
+ Shared commit procedure for all skills that commit.
4
+ Referenced by `/task-plan`, `/task-hardening`, `/ship`, and any future committing skill.
5
+
6
+ **Purpose:** Prevent missed files, wrong staging, and lost work by cross-referencing the edit log against git state before every commit.
7
+
8
+ ## Procedure
9
+
10
+ ### Step 1: Collect modified files from all sources
11
+
12
+ Cross-reference three sources to build the complete file list:
13
+
14
+ **Source A — edit log** (hook-populated, most complete):
15
+ ```bash
16
+ cat /tmp/claude-edits.log 2>/dev/null | grep "Modified:" | sed 's/.*Modified: //' | sort -u
17
+ ```
18
+
19
+ **Source B — task state** (skill-populated, survives log rotation):
20
+ ```bash
21
+ cat "${AUTOPILOT_TASK_STATE:-/tmp/claude-task-state-${task_slug:-unknown}.json}" 2>/dev/null | grep -oP '"[^"]+\.(py|md|json|yaml)"' | tr -d '"' | sort -u
22
+ ```
23
+
24
+ **Source C — git diff** (ground truth):
25
+ ```bash
26
+ git diff --name-only && git diff --name-only --cached
27
+ ```
28
+
29
+ If sources A and B are both empty or missing, source C is sufficient. If any source lists a file the others don't, investigate before proceeding.
30
+
31
+ ### Step 2: Cross-reference with git status
32
+
33
+ ```bash
34
+ git status --porcelain
35
+ ```
36
+
37
+ Compare the two lists. Flag discrepancies:
38
+
39
+ - **Edited but unstaged** (`M` or `?? ` in git status, present in edit log): these MUST be staged or explicitly excluded with a reason.
40
+ - **Staged but not in edit log** (in git status `M ` or `A ` index column, absent from edit log): warn — this may be another agent's work or a stale change. Verify before committing.
41
+ - **Untracked task artifacts** (`?? .tasks/` or `?? .protocols/`): these MUST be staged if they belong to the current task.
42
+
43
+ If any discrepancy is found, list it explicitly before proceeding. Do not silently skip mismatched files.
44
+
45
+ ### Step 3: Stage explicitly
46
+
47
+ Stage ONLY the files that belong to this commit, by name:
48
+
49
+ ```bash
50
+ git add <file1> <file2> ...
51
+ ```
52
+
53
+ **NEVER** use `git add .` or `git add -A`. If the edit log shows files you did not intend to modify, investigate before staging.
54
+
55
+ ### Step 4: Review staged diff
56
+
57
+ ```bash
58
+ git diff --cached --stat
59
+ ```
60
+
61
+ Verify the staged file count and names match expectations. If a file is unexpectedly large or unexpected, investigate.
62
+
63
+ ### Step 5: Commit
64
+
65
+ ```bash
66
+ git commit -m "<message>"
67
+ ```
68
+
69
+ Use the calling skill's commit message format (e.g., `docs(plan):`, `chore(<slug>):`, `fix:`, etc.).
70
+
71
+ **Git trailers (optional but encouraged):** When the task involved rejecting alternatives or discovering constraints, append trailers to the commit message body. These help future sessions avoid re-exploring dead ends:
72
+
73
+ ```
74
+ Rejected: <approach> — <reason>
75
+ Constraint: <invariant discovered during this task>
76
+ Scope-risk: <boundary that future changes should be careful about>
77
+ ```
78
+
79
+ Queryable later via `git log --grep="Rejected:"` or `git log --grep="Constraint:"`.
80
+
81
+ ### Step 6: Post-commit verification
82
+
83
+ ```bash
84
+ git status --short | grep -E "^\?\? \.(tasks|protocols)/TASK-" && echo "ERROR: task artifacts left unstaged — amend now" || echo "ok: no orphaned task artifacts"
85
+ ```
86
+
87
+ If task artifacts remain unstaged:
88
+ 1. Stage them: `git add .tasks/TASK-<slug>/ .protocols/TASK-<slug>/`
89
+ 2. Amend: `git commit --amend --no-edit`
90
+ 3. Re-run the check.
91
+
92
+ ### Step 7: Clear session state
93
+
94
+ ```bash
95
+ : > /tmp/claude-edits.log
96
+ : > "${AUTOPILOT_TASK_STATE:-/tmp/claude-task-state-${task_slug:-unknown}.json}"
97
+ ```
98
+
99
+ This prevents the next commit checkpoint from seeing stale entries from a previous task unit.
100
+
101
+ ## Agent File Coordination
102
+
103
+ Before editing a file in a multi-agent session, check for another agent's uncommitted changes:
104
+
105
+ ```bash
106
+ grep "Modified:.*<target-file>" /tmp/claude-edits.log 2>/dev/null
107
+ ```
108
+
109
+ If the file appears in the edit log but is not yet committed (present in `git status --porcelain` output), another agent may have uncommitted work on it. In that case:
110
+ - **Warn** in chat: "File `<path>` has uncommitted changes from another agent."
111
+ - **Do not overwrite** — either wait for the other agent to commit, or coordinate with the user.
112
+ - If you must edit the file, note the conflict potential in the task state file.
113
+
114
+ This is a cheap coordination mechanism that works on a single branch without requiring multi-branch isolation.
115
+
116
+ ## Rules
117
+
118
+ - Every committing skill MUST follow this procedure instead of writing ad-hoc commit logic.
119
+ - If Step 2 reveals files from another agent's uncommitted work, do NOT stage them. Warn and proceed with only your own files.
120
+ - If the edit log contains files outside the task scope, investigate — they may be side effects from a shared hook or linter auto-fix.
121
+ - The edit log is the primary record. Task state is the secondary record. Git status is the ground truth. All three should agree before committing.
@@ -0,0 +1,25 @@
1
+ # Mode Classification — 5-Axis Triage
2
+
3
+ Shared procedure for classifying a task as `lite`, `standard`, or `strict`.
4
+ Referenced by `/task-plan` and `/task-hardening`.
5
+
6
+ ## Axes
7
+
8
+ Judge these five axes from repo evidence (not user-supplied size labels):
9
+
10
+ - **boundary risk**: storage operations, schema migrations, embedding model changes, MCP tool contracts, CLI breaking changes, backup/restore paths
11
+ - **ambiguity**: multiple plausible implementations, unclear API design, unresolved contract decisions, or (for hardening) ambiguity still remaining in the behavior
12
+ - **blast radius**: number of subsystems/files likely affected and coupling to shared helpers (storage.py, mcp_server.py, miner.py)
13
+ - **verification difficulty**: whether the change needs non-trivial regression coverage or multi-step validation
14
+ - **failure cost**: user data loss, palace corruption, embedding drift, hard-to-reverse regressions
15
+
16
+ ## Decision Rule
17
+
18
+ - `lite` only if all five axes are low and the implementation path looks obvious
19
+ - `strict` if any sensitive boundary is touched or any axis is clearly high
20
+ - otherwise `standard`
21
+ - if still uncertain, choose `standard`
22
+
23
+ ## Size Labels
24
+
25
+ Do not trust user-provided size markers like `[S]`, `[M]`, `XS`, or `low` as authoritative. Treat them as weak hints only. A user-supplied size estimate never overrides repo-evidenced risk.
@@ -0,0 +1,83 @@
1
+ # Task State Handoff — Shared Procedure
2
+
3
+ Shared state persistence for skills running multi-step workflows.
4
+ Referenced by `/task-plan`, `/task-hardening`, and any future multi-step skill.
5
+
6
+ **Purpose:** Survive context compaction by writing task state to disk. After compaction, the agent reads this file instead of relying on degraded context memory to recall which files were modified, what phase it's in, and what decisions were made.
7
+
8
+ ## State File
9
+
10
+ Location: `/tmp/claude-task-state-<SLUG>.json` (e.g., `/tmp/claude-task-state-MINE-CSHARP.json`)
11
+
12
+ Use the task slug in the filename to avoid collisions when multiple sessions or autopilot instances run in parallel. If `AUTOPILOT_TASK_STATE` env var is set, use that path instead.
13
+
14
+ Structure:
15
+
16
+ ```json
17
+ {
18
+ "task_slug": "MINE-CSHARP",
19
+ "skill": "/task-hardening",
20
+ "phase": "triage",
21
+ "started_at": "2026-04-17T14:30:00Z",
22
+ "modified_files": [
23
+ "mempalace/miner.py",
24
+ "mempalace/lang_detect.py",
25
+ "docs/BACKLOG.yaml"
26
+ ],
27
+ "decisions": [
28
+ "F1: missing .cs extension — fix (score 3/3)",
29
+ "F2: symbol extraction regex — fix (score 2/3)",
30
+ "F3: benchmark dataset — backlog only (score 1/3)"
31
+ ],
32
+ "pending_actions": [
33
+ "write round report to docs/audits/",
34
+ "update BACKLOG.yaml",
35
+ "commit via commit-checkpoint"
36
+ ]
37
+ }
38
+ ```
39
+
40
+ ## When to Write
41
+
42
+ - **At skill start**: initialize with task slug, skill name, phase = "started", empty arrays.
43
+ - **After each file edit**: append the file path to `modified_files`.
44
+ - **After each decision**: append a one-line summary to `decisions`.
45
+ - **At phase transitions**: update `phase` (e.g., "research" -> "triage" -> "implementing" -> "committing").
46
+ - **After commit**: clear the file (`: > /tmp/claude-task-state-<SLUG>.json`).
47
+
48
+ ## When to Read
49
+
50
+ - **After context compaction**: if `/start` is invoked mid-task, read the state file to recover task context.
51
+ - **At commit time**: the commit checkpoint (`.claude/skills/_shared/commit-checkpoint.md`) uses `modified_files` as a secondary source alongside the edit log.
52
+ - **On skill resume**: if the user re-invokes a skill after interruption, read the state file to determine where to resume.
53
+
54
+ ## Integration with Commit Checkpoint
55
+
56
+ The commit checkpoint Step 1 should cross-reference three sources:
57
+ 1. `/tmp/claude-edits.log` (hook-populated, most complete)
58
+ 2. `/tmp/claude-task-state-<SLUG>.json` -> `modified_files` (skill-populated, survives log rotation)
59
+ 3. `git diff --name-only` + `git diff --name-only --cached` (ground truth)
60
+
61
+ All three should agree. Discrepancies indicate missed files or stale state.
62
+
63
+ ## Results Ledger (optional)
64
+
65
+ For tasks with experimentation (hardening, debugging, performance tuning), maintain a results log:
66
+
67
+ Location: `/tmp/claude-task-results-<SLUG>.tsv`
68
+
69
+ ```tsv
70
+ timestamp action status description
71
+ 2026-04-17T14:30 try tree-sitter C# keep AST-based chunking for .cs files
72
+ 2026-04-17T14:35 try regex fallback discard misses nested classes
73
+ 2026-04-17T14:40 add symbol metadata keep extracts class/method/property names
74
+ ```
75
+
76
+ This separates "what worked" (git history) from "what was attempted" (ledger). Useful for post-mortems and preventing re-exploration of dead ends. Not committed — lives in `/tmp/` only.
77
+
78
+ ## Rules
79
+
80
+ - The state file and results ledger are ephemeral — do NOT commit them. They exist only in `/tmp/`.
81
+ - One task at a time per state file. If starting a new task, overwrite the previous state.
82
+ - Keep entries short — one line per decision, one path per file. This is a recovery aid, not a log.
83
+ - If the state file is missing or corrupt, fall back to the edit log and git status (no hard failure).
@@ -0,0 +1,113 @@
1
+ ---
2
+ name: bench
3
+ description: Run embedding benchmarks — R@5 code retrieval, timing, model comparison
4
+ disable-model-invocation: false
5
+ ---
6
+
7
+ # Embedding Benchmarks
8
+
9
+ Run retrieval quality and performance benchmarks.
10
+
11
+ ## When to Use
12
+
13
+ - Evaluating embedding model changes
14
+ - Performance regression testing
15
+ - Comparing model candidates
16
+ - User says "benchmark", "bench", "test embeddings"
17
+
18
+ ## Steps
19
+
20
+ ### Step 1: Check Prerequisites
21
+
22
+ ```bash
23
+ # Verify benchmark data exists
24
+ ls benchmarks/data/ 2>/dev/null || echo "No benchmark data"
25
+
26
+ # Verify current model
27
+ python -c "from mempalace.embeddings import get_embedder; e=get_embedder(); print(f'Model: {e.model_name}')"
28
+ ```
29
+
30
+ ### Step 2: Code Retrieval Benchmark
31
+
32
+ Run the standard code retrieval benchmark:
33
+
34
+ ```bash
35
+ python benchmarks/code_retrieval_bench.py --output benchmarks/results_$(date +%Y%m%d).json
36
+ ```
37
+
38
+ Metrics collected:
39
+ - **R@5**: Recall at 5 (target: >= 0.95)
40
+ - **R@10**: Recall at 10 (target: 1.0)
41
+ - **Embed time**: Seconds to embed all chunks
42
+ - **Query time**: Milliseconds per query
43
+ - **Index size**: MB on disk
44
+
45
+ ### Step 3: Category Breakdown
46
+
47
+ If benchmark supports categories:
48
+
49
+ | Category | Description |
50
+ |----------|-------------|
51
+ | architecture | High-level design questions |
52
+ | class_lookup | Find specific class definitions |
53
+ | cross_file | References spanning multiple files |
54
+ | function_lookup | Find specific functions |
55
+
56
+ ### Step 4: Compare Models (optional)
57
+
58
+ If comparing multiple models:
59
+
60
+ ```bash
61
+ # Test each candidate
62
+ for model in "all-MiniLM-L6-v2" "all-mpnet-base-v2"; do
63
+ MEMPALACE_EMBED_MODEL=$model python benchmarks/code_retrieval_bench.py --output benchmarks/results_${model}_$(date +%Y%m%d).json
64
+ done
65
+ ```
66
+
67
+ ### Step 5: Text Retrieval Gate (if changing models)
68
+
69
+ Per project policy, any embedding model change must also pass text retrieval benchmarks:
70
+
71
+ ```bash
72
+ python benchmarks/text_retrieval_bench.py --dataset longmemeval
73
+ ```
74
+
75
+ Target: Match or beat current model on LongMemEval R@5.
76
+
77
+ ## Output Format
78
+
79
+ ```
80
+ ## Benchmark Results
81
+
82
+ Model: all-MiniLM-L6-v2
83
+ Dataset: mempalace code retrieval (20 queries, N chunks)
84
+
85
+ | Metric | Value | Target | Status |
86
+ |--------|-------|--------|--------|
87
+ | R@5 | 0.950 | >= 0.95 | PASS |
88
+ | R@10 | 1.000 | 1.0 | PASS |
89
+ | Embed time | 15.2s | < 60s | PASS |
90
+ | Query time | 15.9ms | < 100ms | PASS |
91
+ | Index size | 17.0 MB | < 50 MB | PASS |
92
+
93
+ Category R@5:
94
+ - architecture: 0.800
95
+ - class_lookup: 1.000
96
+ - cross_file: 1.000
97
+ - function_lookup: 1.000
98
+
99
+ **Verdict: PASS** — Model meets all targets.
100
+ ```
101
+
102
+ ## Model Comparison Table
103
+
104
+ When comparing models, produce:
105
+
106
+ ```
107
+ | Model | R@5 | R@10 | Embed(s) | Query(ms) | Index(MB) |
108
+ |-------|-----|------|----------|-----------|-----------|
109
+ | all-MiniLM-L6-v2 | 0.950 | 1.000 | 15.2 | 15.9 | 17.0 |
110
+ | all-mpnet-base-v2 | 0.900 | 1.000 | 47.5 | 30.5 | 17.7 |
111
+
112
+ **Recommendation:** minilm remains default (better R@5, 3x faster).
113
+ ```
@@ -0,0 +1,118 @@
1
+ # doc-refresh
2
+
3
+ Weekly documentation refresh + maintenance. All steps mechanical — execute sequentially.
4
+
5
+ ## Constraints
6
+
7
+ - Only document what exists in code (verify by reading source).
8
+ - Never remove correct content — only update stale entries and add missing ones.
9
+ - CLAUDE.md is context-loaded every session — keep concise.
10
+ - Verify counts by running commands, not from memory.
11
+ - Update "Last updated" dates on modified doc files.
12
+
13
+ ## Step 1 — Audit staleness
14
+
15
+ Run in parallel:
16
+
17
+ ```bash
18
+ git log --oneline -1 -- docs/BACKUP_RESTORE.md docs/AGENT_INSTALL.md docs/STORAGE.md CLAUDE.md README.md
19
+ ```
20
+ ```bash
21
+ git log --oneline -30 main
22
+ ```
23
+ ```bash
24
+ backlog list --status open --file docs/BACKLOG.yaml
25
+ ```
26
+
27
+ For each doc, diff changed source files since last doc commit:
28
+
29
+ | Doc | Diff scope |
30
+ |-----|-----------|
31
+ | BACKUP_RESTORE.md | `mempalace/backup.py`, `mempalace/storage.py` |
32
+ | AGENT_INSTALL.md | `mempalace/mcp_server.py`, MCP tools |
33
+ | STORAGE.md | `mempalace/storage.py`, schema migrations |
34
+ | CLAUDE.md | `.claude/skills/`, `mempalace/*.py` modules |
35
+ | README.md | CLI commands, MCP tools, installation |
36
+
37
+ Skip docs where diff is empty or test-only.
38
+
39
+ ## Step 2 — Update stale docs
40
+
41
+ ### README.md
42
+
43
+ Check: new CLI commands, new MCP tools, installation changes, supported languages list.
44
+
45
+ ### CLAUDE.md
46
+
47
+ Check: Key Modules table accuracy, new skills tables, architecture principles current.
48
+
49
+ ### AGENT_INSTALL.md
50
+
51
+ Check: MCP tool list matches `mcp_server.py`, installation steps work.
52
+
53
+ ### BACKUP_RESTORE.md
54
+
55
+ Check: CLI commands match implementation, filter semantics current.
56
+
57
+ ## Step 3 — Backlog doc gaps
58
+
59
+ Mark resolved documentation-gap backlog items: `backlog done <SLUG> --summary "summary" --file docs/BACKLOG.yaml`.
60
+
61
+ ## Step 4 — Maintenance
62
+
63
+ Execute all substeps every run.
64
+
65
+ ### 4a. Backlog validate
66
+
67
+ ```bash
68
+ backlog validate --file docs/BACKLOG.yaml
69
+ ```
70
+
71
+ Fix any schema errors. Dangling links are warnings — ignore.
72
+
73
+ ### 4b. Memory cleanup
74
+
75
+ Scan `MEMORY.md` per memory-write-policy. Remove:
76
+ - Outdated versions or archived workflows
77
+ - Session-specific notes that should have been removed
78
+ - Duplicates of CLAUDE.md content
79
+
80
+ ### 4c. Verify check
81
+
82
+ ```bash
83
+ BASELINE=$(cat .verify-state 2>/dev/null)
84
+ if [ -n "$BASELINE" ]; then
85
+ COUNT=$(git log --oneline "$BASELINE"..HEAD 2>/dev/null | wc -l | tr -d ' ')
86
+ echo "Unverified commits: $COUNT"
87
+ else
88
+ echo "No verify baseline — run /verify"
89
+ fi
90
+ ```
91
+
92
+ If >= 30 unverified commits: flag prominently, recommend `/verify` before next deploy.
93
+
94
+ ### 4d. Dead doc references
95
+
96
+ ```bash
97
+ grep -rohn 'docs/[a-zA-Z0-9_./-]*\.md' docs/ CLAUDE.md .claude/ | while IFS=: read -r file line path; do
98
+ [ ! -f "$path" ] && echo "DEAD REF: $file:$line -> $path"
99
+ done
100
+ ```
101
+
102
+ Fix dead refs in CLAUDE.md and `.claude/`. Report count.
103
+
104
+ ### 4e. RTK savings (if rtk installed)
105
+
106
+ ```bash
107
+ rtk discover 2>&1 | head -40 || true
108
+ rtk gain 2>&1 | head -15 || true
109
+ ```
110
+
111
+ ## Output
112
+
113
+ ```
114
+ Updated: [files modified]
115
+ Docs: README [N changes] | CLAUDE [N sections] | AGENT_INSTALL [changes] | BACKUP_RESTORE [changes]
116
+ Backlog gaps: [N resolved]
117
+ Maintenance: validate [pass/fail] | memory [clean/N stale] | verify [N unverified] | dead refs [N in key files]
118
+ ```
@@ -0,0 +1,10 @@
1
+ ---
2
+ name: doc-refresh
3
+ description: Weekly documentation refresh and maintenance - audit staleness, update docs, validate backlog
4
+ disable-model-invocation: false
5
+ ---
6
+
7
+ When to use: cleanup cadence, "update docs", "refresh documentation".
8
+ Not for: single file edits, general refactoring.
9
+
10
+ Read `.claude/skills/doc-refresh/INSTRUCTIONS.md` for the full workflow.