cognitive-core 0.2.0 → 0.2.2
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.
- package/.claude/settings.json +111 -2
- package/.sessionlog/settings.json +4 -0
- package/dist/atlas.d.ts +10 -0
- package/dist/atlas.d.ts.map +1 -1
- package/dist/atlas.js +65 -0
- package/dist/atlas.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/learning/index.d.ts +1 -1
- package/dist/learning/index.d.ts.map +1 -1
- package/dist/learning/index.js.map +1 -1
- package/dist/learning/pipeline.d.ts +4 -31
- package/dist/learning/pipeline.d.ts.map +1 -1
- package/dist/learning/pipeline.js +12 -64
- package/dist/learning/pipeline.js.map +1 -1
- package/dist/learning/unified-pipeline.d.ts +30 -0
- package/dist/learning/unified-pipeline.d.ts.map +1 -1
- package/dist/learning/unified-pipeline.js +207 -0
- package/dist/learning/unified-pipeline.js.map +1 -1
- package/dist/memory/candidate-retrieval.d.ts.map +1 -1
- package/dist/memory/candidate-retrieval.js +3 -1
- package/dist/memory/candidate-retrieval.js.map +1 -1
- package/dist/memory/curated-loader.d.ts +21 -4
- package/dist/memory/curated-loader.d.ts.map +1 -1
- package/dist/memory/curated-loader.js +53 -16
- package/dist/memory/curated-loader.js.map +1 -1
- package/dist/memory/index.d.ts +2 -1
- package/dist/memory/index.d.ts.map +1 -1
- package/dist/memory/index.js +3 -1
- package/dist/memory/index.js.map +1 -1
- package/dist/memory/playbook.d.ts +6 -0
- package/dist/memory/playbook.d.ts.map +1 -1
- package/dist/memory/playbook.js +15 -0
- package/dist/memory/playbook.js.map +1 -1
- package/dist/memory/source-resolver.d.ts +120 -0
- package/dist/memory/source-resolver.d.ts.map +1 -0
- package/dist/memory/source-resolver.js +300 -0
- package/dist/memory/source-resolver.js.map +1 -0
- package/dist/types/config.d.ts +141 -0
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/config.js +40 -0
- package/dist/types/config.js.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +1 -1
- package/dist/types/index.js.map +1 -1
- package/dist/utils/error-classifier.js +8 -8
- package/dist/utils/error-classifier.js.map +1 -1
- package/dist/workspace/efficacy-toolkit.d.ts +164 -0
- package/dist/workspace/efficacy-toolkit.d.ts.map +1 -0
- package/dist/workspace/efficacy-toolkit.js +281 -0
- package/dist/workspace/efficacy-toolkit.js.map +1 -0
- package/dist/workspace/index.d.ts +2 -1
- package/dist/workspace/index.d.ts.map +1 -1
- package/dist/workspace/index.js +3 -1
- package/dist/workspace/index.js.map +1 -1
- package/dist/workspace/templates/index.d.ts +3 -0
- package/dist/workspace/templates/index.d.ts.map +1 -1
- package/dist/workspace/templates/index.js +6 -0
- package/dist/workspace/templates/index.js.map +1 -1
- package/dist/workspace/templates/playbook-decay-detection.d.ts +46 -0
- package/dist/workspace/templates/playbook-decay-detection.d.ts.map +1 -0
- package/dist/workspace/templates/playbook-decay-detection.js +197 -0
- package/dist/workspace/templates/playbook-decay-detection.js.map +1 -0
- package/dist/workspace/templates/playbook-efficacy-audit.d.ts +46 -0
- package/dist/workspace/templates/playbook-efficacy-audit.d.ts.map +1 -0
- package/dist/workspace/templates/playbook-efficacy-audit.js +160 -0
- package/dist/workspace/templates/playbook-efficacy-audit.js.map +1 -0
- package/dist/workspace/templates/playbook-lifecycle-review.d.ts +51 -0
- package/dist/workspace/templates/playbook-lifecycle-review.d.ts.map +1 -0
- package/dist/workspace/templates/playbook-lifecycle-review.js +187 -0
- package/dist/workspace/templates/playbook-lifecycle-review.js.map +1 -0
- package/dist/workspace/types.d.ts +12 -54
- package/dist/workspace/types.d.ts.map +1 -1
- package/dist/workspace/types.js.map +1 -1
- package/package.json +8 -2
- package/playbooks/compound-engineering/adversarial-review.json +51 -0
- package/playbooks/compound-engineering/agent-native-architecture.json +59 -0
- package/playbooks/compound-engineering/agent-native-review.json +54 -0
- package/playbooks/compound-engineering/api-contract-review.json +52 -0
- package/playbooks/compound-engineering/brainstorm-requirements.json +55 -0
- package/playbooks/compound-engineering/bug-reproduction.json +62 -0
- package/playbooks/compound-engineering/confidence-calibration.json +49 -0
- package/playbooks/compound-engineering/correctness-review.json +49 -0
- package/playbooks/compound-engineering/data-migration-safety.json +59 -0
- package/playbooks/compound-engineering/deployment-verification.json +63 -0
- package/playbooks/compound-engineering/error-recovery-patterns.json +53 -0
- package/playbooks/compound-engineering/implementation-planning.json +64 -0
- package/playbooks/compound-engineering/issue-pattern-analysis.json +53 -0
- package/playbooks/compound-engineering/knowledge-compounding.json +63 -0
- package/playbooks/compound-engineering/learnings-research.json +54 -0
- package/playbooks/compound-engineering/maintainability-review.json +49 -0
- package/playbooks/compound-engineering/performance-review.json +54 -0
- package/playbooks/compound-engineering/plan-adversarial-review.json +56 -0
- package/playbooks/compound-engineering/plan-feasibility-review.json +56 -0
- package/playbooks/compound-engineering/project-standards-review.json +52 -0
- package/playbooks/compound-engineering/reliability-review.json +53 -0
- package/playbooks/compound-engineering/review-orchestration.json +64 -0
- package/playbooks/compound-engineering/security-review.json +54 -0
- package/playbooks/compound-engineering/systematic-execution.json +64 -0
- package/playbooks/compound-engineering/testing-review.json +50 -0
- package/src/atlas.ts +96 -0
- package/src/index.ts +27 -0
- package/src/learning/index.ts +1 -0
- package/src/learning/unified-pipeline.ts +271 -1
- package/src/memory/candidate-retrieval.ts +2 -1
- package/src/memory/curated-loader.ts +69 -16
- package/src/memory/index.ts +16 -0
- package/src/memory/playbook.ts +19 -0
- package/src/memory/source-resolver.ts +422 -0
- package/src/types/config.ts +46 -0
- package/src/types/index.ts +4 -0
- package/src/utils/error-classifier.ts +8 -8
- package/src/workspace/efficacy-toolkit.ts +496 -0
- package/src/workspace/index.ts +29 -0
- package/src/workspace/templates/index.ts +24 -0
- package/src/workspace/templates/playbook-decay-detection.ts +272 -0
- package/src/workspace/templates/playbook-efficacy-audit.ts +246 -0
- package/src/workspace/templates/playbook-lifecycle-review.ts +274 -0
- package/src/workspace/types.ts +22 -78
- package/tests/fixtures/behavioral-trajectories.ts +210 -0
- package/tests/integration/curated-sources-e2e.test.ts +502 -0
- package/tests/integration/pipeline-data-correctness.test.ts +794 -0
- package/tests/learning/meta-learner.test.ts +418 -0
- package/tests/learning/pipeline-memory-updates.test.ts +721 -0
- package/tests/learning/unified-pipeline-efficacy.test.ts +232 -0
- package/tests/memory/candidate-retrieval.test.ts +167 -0
- package/tests/memory/compound-engineering-seed.test.ts +338 -0
- package/tests/memory/curated-loader-extended.test.ts +225 -0
- package/tests/memory/meta.test.ts +399 -0
- package/tests/memory/playbook-quality-validation.test.ts +430 -0
- package/tests/memory/source-resolver.test.ts +700 -0
- package/tests/search/evaluator.test.ts +257 -0
- package/tests/search/verification-runner.test.ts +357 -0
- package/tests/utils/error-classifier.test.ts +149 -0
- package/tests/utils/trajectory-helpers.test.ts +163 -0
- package/tests/workspace/efficacy-toolkit.test.ts +404 -0
- package/tests/workspace/templates/playbook-efficacy.test.ts +377 -0
- package/.claude/settings.local.json +0 -11
- package/dist/learning/llm-extractor.d.ts +0 -88
- package/dist/learning/llm-extractor.d.ts.map +0 -1
- package/dist/learning/llm-extractor.js +0 -372
- package/dist/learning/llm-extractor.js.map +0 -1
- package/dist/learning/loop-coordinator.d.ts +0 -61
- package/dist/learning/loop-coordinator.d.ts.map +0 -1
- package/dist/learning/loop-coordinator.js +0 -96
- package/dist/learning/loop-coordinator.js.map +0 -1
- package/references/agent-workspace/CLAUDE.md +0 -74
- package/references/agent-workspace/README.md +0 -587
- package/references/agent-workspace/media/banner.png +0 -0
- package/references/agent-workspace/package-lock.json +0 -2061
- package/references/agent-workspace/package.json +0 -54
- package/references/agent-workspace/src/handle.ts +0 -122
- package/references/agent-workspace/src/index.ts +0 -32
- package/references/agent-workspace/src/manager.ts +0 -102
- package/references/agent-workspace/src/readers/json.ts +0 -71
- package/references/agent-workspace/src/readers/markdown.ts +0 -37
- package/references/agent-workspace/src/readers/raw.ts +0 -27
- package/references/agent-workspace/src/types.ts +0 -68
- package/references/agent-workspace/src/validation.ts +0 -93
- package/references/agent-workspace/src/writers/json.ts +0 -17
- package/references/agent-workspace/src/writers/markdown.ts +0 -27
- package/references/agent-workspace/src/writers/raw.ts +0 -22
- package/references/agent-workspace/tests/errors.test.ts +0 -652
- package/references/agent-workspace/tests/handle.test.ts +0 -144
- package/references/agent-workspace/tests/manager.test.ts +0 -124
- package/references/agent-workspace/tests/readers.test.ts +0 -205
- package/references/agent-workspace/tests/validation.test.ts +0 -196
- package/references/agent-workspace/tests/writers.test.ts +0 -108
- package/references/agent-workspace/tsconfig.json +0 -20
- package/references/agent-workspace/tsup.config.ts +0 -9
- package/references/minimem/.claude/settings.json +0 -7
- package/references/minimem/.sudocode/issues.jsonl +0 -18
- package/references/minimem/.sudocode/specs.jsonl +0 -1
- package/references/minimem/CLAUDE.md +0 -310
- package/references/minimem/README.md +0 -556
- package/references/minimem/claude-plugin/.claude-plugin/plugin.json +0 -10
- package/references/minimem/claude-plugin/.mcp.json +0 -7
- package/references/minimem/claude-plugin/README.md +0 -158
- package/references/minimem/claude-plugin/commands/recall.md +0 -47
- package/references/minimem/claude-plugin/commands/remember.md +0 -41
- package/references/minimem/claude-plugin/hooks/__tests__/hooks.test.ts +0 -272
- package/references/minimem/claude-plugin/hooks/hooks.json +0 -27
- package/references/minimem/claude-plugin/hooks/session-end.sh +0 -86
- package/references/minimem/claude-plugin/hooks/session-start.sh +0 -85
- package/references/minimem/claude-plugin/skills/memory/SKILL.md +0 -108
- package/references/minimem/package-lock.json +0 -5373
- package/references/minimem/package.json +0 -60
- package/references/minimem/scripts/postbuild.js +0 -35
- package/references/minimem/src/__tests__/edge-cases.test.ts +0 -371
- package/references/minimem/src/__tests__/errors.test.ts +0 -265
- package/references/minimem/src/__tests__/helpers.ts +0 -199
- package/references/minimem/src/__tests__/internal.test.ts +0 -407
- package/references/minimem/src/__tests__/knowledge.test.ts +0 -287
- package/references/minimem/src/__tests__/minimem.integration.test.ts +0 -1127
- package/references/minimem/src/__tests__/session.test.ts +0 -190
- package/references/minimem/src/cli/__tests__/commands.test.ts +0 -759
- package/references/minimem/src/cli/commands/__tests__/conflicts.test.ts +0 -141
- package/references/minimem/src/cli/commands/append.ts +0 -76
- package/references/minimem/src/cli/commands/config.ts +0 -262
- package/references/minimem/src/cli/commands/conflicts.ts +0 -413
- package/references/minimem/src/cli/commands/daemon.ts +0 -169
- package/references/minimem/src/cli/commands/index.ts +0 -12
- package/references/minimem/src/cli/commands/init.ts +0 -88
- package/references/minimem/src/cli/commands/mcp.ts +0 -177
- package/references/minimem/src/cli/commands/push-pull.ts +0 -213
- package/references/minimem/src/cli/commands/search.ts +0 -158
- package/references/minimem/src/cli/commands/status.ts +0 -84
- package/references/minimem/src/cli/commands/sync-init.ts +0 -290
- package/references/minimem/src/cli/commands/sync.ts +0 -70
- package/references/minimem/src/cli/commands/upsert.ts +0 -197
- package/references/minimem/src/cli/config.ts +0 -584
- package/references/minimem/src/cli/index.ts +0 -264
- package/references/minimem/src/cli/shared.ts +0 -161
- package/references/minimem/src/cli/sync/__tests__/central.test.ts +0 -152
- package/references/minimem/src/cli/sync/__tests__/conflicts.test.ts +0 -209
- package/references/minimem/src/cli/sync/__tests__/daemon.test.ts +0 -118
- package/references/minimem/src/cli/sync/__tests__/detection.test.ts +0 -207
- package/references/minimem/src/cli/sync/__tests__/integration.test.ts +0 -476
- package/references/minimem/src/cli/sync/__tests__/registry.test.ts +0 -363
- package/references/minimem/src/cli/sync/__tests__/state.test.ts +0 -255
- package/references/minimem/src/cli/sync/__tests__/validation.test.ts +0 -193
- package/references/minimem/src/cli/sync/__tests__/watcher.test.ts +0 -178
- package/references/minimem/src/cli/sync/central.ts +0 -292
- package/references/minimem/src/cli/sync/conflicts.ts +0 -204
- package/references/minimem/src/cli/sync/daemon.ts +0 -407
- package/references/minimem/src/cli/sync/detection.ts +0 -138
- package/references/minimem/src/cli/sync/index.ts +0 -107
- package/references/minimem/src/cli/sync/operations.ts +0 -373
- package/references/minimem/src/cli/sync/registry.ts +0 -279
- package/references/minimem/src/cli/sync/state.ts +0 -355
- package/references/minimem/src/cli/sync/validation.ts +0 -206
- package/references/minimem/src/cli/sync/watcher.ts +0 -234
- package/references/minimem/src/cli/version.ts +0 -34
- package/references/minimem/src/core/index.ts +0 -9
- package/references/minimem/src/core/indexer.ts +0 -628
- package/references/minimem/src/core/searcher.ts +0 -221
- package/references/minimem/src/db/schema.ts +0 -183
- package/references/minimem/src/db/sqlite-vec.ts +0 -24
- package/references/minimem/src/embeddings/__tests__/embeddings.test.ts +0 -431
- package/references/minimem/src/embeddings/batch-gemini.ts +0 -392
- package/references/minimem/src/embeddings/batch-openai.ts +0 -409
- package/references/minimem/src/embeddings/embeddings.ts +0 -434
- package/references/minimem/src/index.ts +0 -109
- package/references/minimem/src/internal.ts +0 -299
- package/references/minimem/src/minimem.ts +0 -1276
- package/references/minimem/src/search/__tests__/hybrid.test.ts +0 -247
- package/references/minimem/src/search/graph.ts +0 -234
- package/references/minimem/src/search/hybrid.ts +0 -151
- package/references/minimem/src/search/search.ts +0 -256
- package/references/minimem/src/server/__tests__/mcp.test.ts +0 -341
- package/references/minimem/src/server/__tests__/tools.test.ts +0 -364
- package/references/minimem/src/server/mcp.ts +0 -326
- package/references/minimem/src/server/tools.ts +0 -720
- package/references/minimem/src/session.ts +0 -460
- package/references/minimem/tsconfig.json +0 -19
- package/references/minimem/tsup.config.ts +0 -26
- package/references/minimem/vitest.config.ts +0 -24
- package/references/sessionlog/.husky/pre-commit +0 -1
- package/references/sessionlog/.lintstagedrc.json +0 -4
- package/references/sessionlog/.prettierignore +0 -4
- package/references/sessionlog/.prettierrc.json +0 -11
- package/references/sessionlog/LICENSE +0 -21
- package/references/sessionlog/README.md +0 -453
- package/references/sessionlog/eslint.config.js +0 -58
- package/references/sessionlog/package-lock.json +0 -3672
- package/references/sessionlog/package.json +0 -65
- package/references/sessionlog/src/__tests__/agent-hooks.test.ts +0 -570
- package/references/sessionlog/src/__tests__/agent-registry.test.ts +0 -127
- package/references/sessionlog/src/__tests__/claude-code-hooks.test.ts +0 -225
- package/references/sessionlog/src/__tests__/claude-generator.test.ts +0 -46
- package/references/sessionlog/src/__tests__/commit-msg.test.ts +0 -86
- package/references/sessionlog/src/__tests__/cursor-agent.test.ts +0 -224
- package/references/sessionlog/src/__tests__/e2e-live.test.ts +0 -890
- package/references/sessionlog/src/__tests__/event-log.test.ts +0 -183
- package/references/sessionlog/src/__tests__/flush-sentinel.test.ts +0 -105
- package/references/sessionlog/src/__tests__/gemini-agent.test.ts +0 -375
- package/references/sessionlog/src/__tests__/git-hooks.test.ts +0 -78
- package/references/sessionlog/src/__tests__/hook-managers.test.ts +0 -121
- package/references/sessionlog/src/__tests__/lifecycle-tasks.test.ts +0 -759
- package/references/sessionlog/src/__tests__/opencode-agent.test.ts +0 -338
- package/references/sessionlog/src/__tests__/redaction.test.ts +0 -136
- package/references/sessionlog/src/__tests__/session-repo.test.ts +0 -353
- package/references/sessionlog/src/__tests__/session-store.test.ts +0 -166
- package/references/sessionlog/src/__tests__/setup-ccweb.test.ts +0 -466
- package/references/sessionlog/src/__tests__/skill-live.test.ts +0 -461
- package/references/sessionlog/src/__tests__/summarize.test.ts +0 -348
- package/references/sessionlog/src/__tests__/task-plan-e2e.test.ts +0 -610
- package/references/sessionlog/src/__tests__/task-plan-live.test.ts +0 -632
- package/references/sessionlog/src/__tests__/transcript-timestamp.test.ts +0 -121
- package/references/sessionlog/src/__tests__/types.test.ts +0 -166
- package/references/sessionlog/src/__tests__/utils.test.ts +0 -333
- package/references/sessionlog/src/__tests__/validation.test.ts +0 -103
- package/references/sessionlog/src/__tests__/worktree.test.ts +0 -57
- package/references/sessionlog/src/agent/agents/claude-code.ts +0 -1089
- package/references/sessionlog/src/agent/agents/cursor.ts +0 -361
- package/references/sessionlog/src/agent/agents/gemini-cli.ts +0 -632
- package/references/sessionlog/src/agent/agents/opencode.ts +0 -540
- package/references/sessionlog/src/agent/registry.ts +0 -143
- package/references/sessionlog/src/agent/session-types.ts +0 -113
- package/references/sessionlog/src/agent/types.ts +0 -220
- package/references/sessionlog/src/cli.ts +0 -597
- package/references/sessionlog/src/commands/clean.ts +0 -133
- package/references/sessionlog/src/commands/disable.ts +0 -84
- package/references/sessionlog/src/commands/doctor.ts +0 -145
- package/references/sessionlog/src/commands/enable.ts +0 -202
- package/references/sessionlog/src/commands/explain.ts +0 -261
- package/references/sessionlog/src/commands/reset.ts +0 -105
- package/references/sessionlog/src/commands/resume.ts +0 -180
- package/references/sessionlog/src/commands/rewind.ts +0 -195
- package/references/sessionlog/src/commands/setup-ccweb.ts +0 -275
- package/references/sessionlog/src/commands/status.ts +0 -172
- package/references/sessionlog/src/config.ts +0 -165
- package/references/sessionlog/src/events/event-log.ts +0 -126
- package/references/sessionlog/src/git-operations.ts +0 -558
- package/references/sessionlog/src/hooks/git-hooks.ts +0 -165
- package/references/sessionlog/src/hooks/lifecycle.ts +0 -391
- package/references/sessionlog/src/index.ts +0 -650
- package/references/sessionlog/src/security/redaction.ts +0 -283
- package/references/sessionlog/src/session/state-machine.ts +0 -452
- package/references/sessionlog/src/store/checkpoint-store.ts +0 -509
- package/references/sessionlog/src/store/native-store.ts +0 -173
- package/references/sessionlog/src/store/provider-types.ts +0 -99
- package/references/sessionlog/src/store/session-store.ts +0 -266
- package/references/sessionlog/src/strategy/attribution.ts +0 -296
- package/references/sessionlog/src/strategy/common.ts +0 -207
- package/references/sessionlog/src/strategy/content-overlap.ts +0 -228
- package/references/sessionlog/src/strategy/manual-commit.ts +0 -988
- package/references/sessionlog/src/strategy/types.ts +0 -279
- package/references/sessionlog/src/summarize/claude-generator.ts +0 -115
- package/references/sessionlog/src/summarize/summarize.ts +0 -432
- package/references/sessionlog/src/types.ts +0 -508
- package/references/sessionlog/src/utils/chunk-files.ts +0 -49
- package/references/sessionlog/src/utils/commit-message.ts +0 -65
- package/references/sessionlog/src/utils/detect-agent.ts +0 -36
- package/references/sessionlog/src/utils/hook-managers.ts +0 -125
- package/references/sessionlog/src/utils/ide-tags.ts +0 -32
- package/references/sessionlog/src/utils/paths.ts +0 -79
- package/references/sessionlog/src/utils/preview-rewind.ts +0 -80
- package/references/sessionlog/src/utils/rewind-conflict.ts +0 -121
- package/references/sessionlog/src/utils/shadow-branch.ts +0 -109
- package/references/sessionlog/src/utils/string-utils.ts +0 -46
- package/references/sessionlog/src/utils/todo-extract.ts +0 -188
- package/references/sessionlog/src/utils/trailers.ts +0 -187
- package/references/sessionlog/src/utils/transcript-parse.ts +0 -177
- package/references/sessionlog/src/utils/transcript-timestamp.ts +0 -59
- package/references/sessionlog/src/utils/tree-ops.ts +0 -219
- package/references/sessionlog/src/utils/tty.ts +0 -72
- package/references/sessionlog/src/utils/validation.ts +0 -65
- package/references/sessionlog/src/utils/worktree.ts +0 -58
- package/references/sessionlog/src/wire-types.ts +0 -59
- package/references/sessionlog/templates/setup-env.sh +0 -153
- package/references/sessionlog/tsconfig.json +0 -18
- package/references/sessionlog/vitest.config.ts +0 -12
- package/references/skill-tree/.claude/settings.json +0 -6
- package/references/skill-tree/.sudocode/issues.jsonl +0 -19
- package/references/skill-tree/.sudocode/specs.jsonl +0 -3
- package/references/skill-tree/CLAUDE.md +0 -126
- package/references/skill-tree/README.md +0 -372
- package/references/skill-tree/docs/GAPS_v1.md +0 -221
- package/references/skill-tree/docs/INTEGRATION_PLAN.md +0 -467
- package/references/skill-tree/docs/TODOS.md +0 -91
- package/references/skill-tree/docs/anthropic_skill_guide.md +0 -1364
- package/references/skill-tree/docs/design/federated-skill-trees.md +0 -524
- package/references/skill-tree/docs/design/multi-agent-sync.md +0 -759
- package/references/skill-tree/docs/scraper/BRAINSTORM.md +0 -583
- package/references/skill-tree/docs/scraper/POC_PLAN.md +0 -420
- package/references/skill-tree/docs/scraper/README.md +0 -170
- package/references/skill-tree/examples/basic-usage.ts +0 -164
- package/references/skill-tree/package-lock.json +0 -1852
- package/references/skill-tree/package.json +0 -66
- package/references/skill-tree/scraper/README.md +0 -123
- package/references/skill-tree/scraper/docs/DESIGN.md +0 -683
- package/references/skill-tree/scraper/docs/PLAN.md +0 -336
- package/references/skill-tree/scraper/drizzle.config.ts +0 -10
- package/references/skill-tree/scraper/package-lock.json +0 -6329
- package/references/skill-tree/scraper/package.json +0 -68
- package/references/skill-tree/scraper/test/fixtures/invalid-skill/missing-description.md +0 -7
- package/references/skill-tree/scraper/test/fixtures/invalid-skill/missing-name.md +0 -7
- package/references/skill-tree/scraper/test/fixtures/minimal-skill/SKILL.md +0 -27
- package/references/skill-tree/scraper/test/fixtures/skill-json/SKILL.json +0 -21
- package/references/skill-tree/scraper/test/fixtures/skill-with-meta/SKILL.md +0 -54
- package/references/skill-tree/scraper/test/fixtures/skill-with-meta/_meta.json +0 -24
- package/references/skill-tree/scraper/test/fixtures/valid-skill/SKILL.md +0 -93
- package/references/skill-tree/scraper/test/fixtures/valid-skill/_meta.json +0 -22
- package/references/skill-tree/scraper/tsup.config.ts +0 -14
- package/references/skill-tree/scraper/vitest.config.ts +0 -17
- package/references/skill-tree/scripts/convert-to-vitest.ts +0 -166
- package/references/skill-tree/skills/skill-writer/SKILL.md +0 -339
- package/references/skill-tree/skills/skill-writer/references/examples.md +0 -326
- package/references/skill-tree/skills/skill-writer/references/patterns.md +0 -210
- package/references/skill-tree/skills/skill-writer/references/quality-checklist.md +0 -123
- package/references/skill-tree/test/run-all.ts +0 -106
- package/references/skill-tree/test/utils.ts +0 -128
- package/references/skill-tree/vitest.config.ts +0 -16
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
# minimem Claude Code Plugin
|
|
2
|
-
|
|
3
|
-
A Claude Code plugin that provides memory capabilities via the minimem semantic search system.
|
|
4
|
-
|
|
5
|
-
## Features
|
|
6
|
-
|
|
7
|
-
- **MCP Server**: Provides `memory_search` tool for semantic search across memories
|
|
8
|
-
- **Memory Skill**: Automatically invoked when storing or recalling information
|
|
9
|
-
- **Commands**:
|
|
10
|
-
- `/minimem:remember <text>` - Store information for later
|
|
11
|
-
- `/minimem:recall <query>` - Search for stored memories
|
|
12
|
-
|
|
13
|
-
## Installation
|
|
14
|
-
|
|
15
|
-
### Prerequisites
|
|
16
|
-
|
|
17
|
-
1. Install minimem globally:
|
|
18
|
-
```bash
|
|
19
|
-
npm install -g minimem
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
2. Initialize your global memory directory:
|
|
23
|
-
```bash
|
|
24
|
-
minimem init --global
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
3. Set your embedding API key:
|
|
28
|
-
```bash
|
|
29
|
-
export OPENAI_API_KEY=your-key
|
|
30
|
-
# or
|
|
31
|
-
export GOOGLE_API_KEY=your-key
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
### Install the Plugin
|
|
35
|
-
|
|
36
|
-
#### Option 1: Test locally during development
|
|
37
|
-
|
|
38
|
-
```bash
|
|
39
|
-
claude --plugin-dir /path/to/minimem/claude-plugin
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
#### Option 2: Install from a marketplace
|
|
43
|
-
|
|
44
|
-
If this plugin is published to a marketplace:
|
|
45
|
-
|
|
46
|
-
```
|
|
47
|
-
/plugin install minimem
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
## Usage
|
|
51
|
-
|
|
52
|
-
### Automatic Memory Skill
|
|
53
|
-
|
|
54
|
-
The memory skill is automatically invoked when you:
|
|
55
|
-
- Ask Claude to "remember" something
|
|
56
|
-
- Ask Claude to "recall" or "find" previous context
|
|
57
|
-
- Reference past decisions or notes
|
|
58
|
-
|
|
59
|
-
### Manual Commands
|
|
60
|
-
|
|
61
|
-
```
|
|
62
|
-
# Store a memory
|
|
63
|
-
/minimem:remember We decided to use PostgreSQL for the database
|
|
64
|
-
|
|
65
|
-
# Search memories
|
|
66
|
-
/minimem:recall database decisions
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
### Direct MCP Tool
|
|
70
|
-
|
|
71
|
-
The `memory_search` tool is available for direct use:
|
|
72
|
-
|
|
73
|
-
```
|
|
74
|
-
memory_search("api design decisions", maxResults=5)
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
## Configuration
|
|
78
|
-
|
|
79
|
-
### Default Behavior
|
|
80
|
-
|
|
81
|
-
By default, the plugin searches both:
|
|
82
|
-
- **Current directory** (`.`) - Project-specific memories
|
|
83
|
-
- **Global** (`~/.minimem`) - Shared memories across all projects
|
|
84
|
-
|
|
85
|
-
This means project context is available when working in a project, and global memories are always accessible.
|
|
86
|
-
|
|
87
|
-
### Custom Memory Locations
|
|
88
|
-
|
|
89
|
-
To use only specific directories, modify `.mcp.json`:
|
|
90
|
-
|
|
91
|
-
```json
|
|
92
|
-
{
|
|
93
|
-
"minimem": {
|
|
94
|
-
"command": "npx",
|
|
95
|
-
"args": ["minimem", "mcp", "--dir", "/path/to/work", "--dir", "/path/to/personal"]
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
### Global Only
|
|
101
|
-
|
|
102
|
-
To use only the global memory directory:
|
|
103
|
-
|
|
104
|
-
```json
|
|
105
|
-
{
|
|
106
|
-
"minimem": {
|
|
107
|
-
"command": "npx",
|
|
108
|
-
"args": ["minimem", "mcp", "--global"]
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
## Plugin Structure
|
|
114
|
-
|
|
115
|
-
```
|
|
116
|
-
claude-plugin/
|
|
117
|
-
├── .claude-plugin/
|
|
118
|
-
│ └── plugin.json # Plugin manifest
|
|
119
|
-
├── .mcp.json # MCP server definition
|
|
120
|
-
├── skills/
|
|
121
|
-
│ └── memory/
|
|
122
|
-
│ └── SKILL.md # Memory skill (auto-invoked)
|
|
123
|
-
├── commands/
|
|
124
|
-
│ ├── remember.md # /minimem:remember command
|
|
125
|
-
│ └── recall.md # /minimem:recall command
|
|
126
|
-
└── README.md # This file
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
## Troubleshooting
|
|
130
|
-
|
|
131
|
-
### "minimem command not found"
|
|
132
|
-
|
|
133
|
-
Ensure minimem is installed globally:
|
|
134
|
-
```bash
|
|
135
|
-
npm install -g minimem
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
### "No API key found"
|
|
139
|
-
|
|
140
|
-
Set your embedding provider API key:
|
|
141
|
-
```bash
|
|
142
|
-
export OPENAI_API_KEY=sk-...
|
|
143
|
-
# or
|
|
144
|
-
export GOOGLE_API_KEY=...
|
|
145
|
-
```
|
|
146
|
-
|
|
147
|
-
### "Memory directory not initialized"
|
|
148
|
-
|
|
149
|
-
Initialize the memory directory:
|
|
150
|
-
```bash
|
|
151
|
-
minimem init --global
|
|
152
|
-
# or
|
|
153
|
-
minimem init /path/to/directory
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
## License
|
|
157
|
-
|
|
158
|
-
MIT
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Search memories for relevant information
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
# Recall Command
|
|
6
|
-
|
|
7
|
-
Search for memories matching: "$ARGUMENTS"
|
|
8
|
-
|
|
9
|
-
## Instructions
|
|
10
|
-
|
|
11
|
-
1. Use `memory_search` MCP tool with the user's query (compact mode by default)
|
|
12
|
-
2. If results are found:
|
|
13
|
-
- Show the compact index (path, score, preview)
|
|
14
|
-
- Use `memory_get_details` to fetch full text for the top 2-3 most relevant results
|
|
15
|
-
- Summarize the key information
|
|
16
|
-
- Offer to fetch more details if needed
|
|
17
|
-
3. If no results:
|
|
18
|
-
- Suggest alternative search terms
|
|
19
|
-
- Try filtering by type if the query implies a category (e.g., "decisions" → type: "decision")
|
|
20
|
-
- Offer to help store relevant information
|
|
21
|
-
|
|
22
|
-
## Response Format
|
|
23
|
-
|
|
24
|
-
**When results found:**
|
|
25
|
-
|
|
26
|
-
Show results clearly with:
|
|
27
|
-
- Relevance score (percentage)
|
|
28
|
-
- Source file and line numbers
|
|
29
|
-
- Full text of the top results (fetched via memory_get_details)
|
|
30
|
-
- A brief summary synthesizing the findings
|
|
31
|
-
|
|
32
|
-
**When no results:**
|
|
33
|
-
|
|
34
|
-
"I couldn't find memories matching '[query]'. Try:
|
|
35
|
-
- [alternative search term 1]
|
|
36
|
-
- [alternative search term 2]
|
|
37
|
-
- Filtering by type: `decision`, `bugfix`, `feature`, `discovery`
|
|
38
|
-
|
|
39
|
-
Use `/minimem:remember` to store information for later."
|
|
40
|
-
|
|
41
|
-
## Tips
|
|
42
|
-
|
|
43
|
-
- Use the two-phase workflow: compact search first, then fetch details
|
|
44
|
-
- If the query mentions decisions, bugs, or features, add the `type` filter
|
|
45
|
-
- If the query is vague, ask for clarification
|
|
46
|
-
- Try broader terms if initial search returns few results
|
|
47
|
-
- Mention the source files so the user can read more context
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Store information in memory for later recall
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
# Remember Command
|
|
6
|
-
|
|
7
|
-
Store the following information in memory: "$ARGUMENTS"
|
|
8
|
-
|
|
9
|
-
## Instructions
|
|
10
|
-
|
|
11
|
-
1. Parse what the user wants to remember from the arguments
|
|
12
|
-
2. Determine the appropriate file:
|
|
13
|
-
- General notes → `memory/YYYY-MM-DD.md` (today's date)
|
|
14
|
-
- Important decisions → `MEMORY.md`
|
|
15
|
-
- Topic-specific → `memory/<topic>.md`
|
|
16
|
-
3. Infer the observation type from context:
|
|
17
|
-
- Architectural/design choices → `decision`
|
|
18
|
-
- Bug fixes, root causes → `bugfix`
|
|
19
|
-
- New feature details → `feature`
|
|
20
|
-
- Learned facts, TILs → `discovery`
|
|
21
|
-
- Setup notes, environment → `context`
|
|
22
|
-
- Everything else → `note`
|
|
23
|
-
4. Format the entry with a timestamp and type:
|
|
24
|
-
```markdown
|
|
25
|
-
### YYYY-MM-DD HH:MM
|
|
26
|
-
<!-- type: decision -->
|
|
27
|
-
<content>
|
|
28
|
-
```
|
|
29
|
-
5. If content contains sensitive data (keys, passwords), wrap those parts in `<private>` tags
|
|
30
|
-
6. Use the Write or Edit tool to update the content as a regular Markdown file
|
|
31
|
-
7. Confirm what was stored and where
|
|
32
|
-
|
|
33
|
-
## Response Format
|
|
34
|
-
|
|
35
|
-
After storing, confirm:
|
|
36
|
-
- What was remembered
|
|
37
|
-
- Which file it was stored in
|
|
38
|
-
- The observation type assigned
|
|
39
|
-
- How to find it later (suggest search terms and type filter)
|
|
40
|
-
|
|
41
|
-
Example: "I've stored your architecture decision in today's log (memory/2026-02-14.md) with type 'decision'. Search with `memory_search(query: 'rate limit', type: 'decision')` to find it later."
|
|
@@ -1,272 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tests for hook scripts config checking behavior.
|
|
3
|
-
*
|
|
4
|
-
* These tests verify that session-start and session-end hooks
|
|
5
|
-
* respect the hooks config (enabled/disabled). They run the actual
|
|
6
|
-
* shell scripts in temp directories with controlled configs.
|
|
7
|
-
*
|
|
8
|
-
* Run with: npx tsx --test claude-plugin/hooks/__tests__/hooks.test.ts
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import { execSync } from "node:child_process";
|
|
12
|
-
import fs from "node:fs/promises";
|
|
13
|
-
import os from "node:os";
|
|
14
|
-
import path from "node:path";
|
|
15
|
-
import { after, afterEach, beforeEach, describe, it } from "node:test";
|
|
16
|
-
import assert from "node:assert";
|
|
17
|
-
|
|
18
|
-
const HOOKS_DIR = path.resolve(
|
|
19
|
-
import.meta.dirname,
|
|
20
|
-
"..",
|
|
21
|
-
);
|
|
22
|
-
|
|
23
|
-
describe("hook scripts config checks", () => {
|
|
24
|
-
let tempDir: string;
|
|
25
|
-
let originalHome: string;
|
|
26
|
-
|
|
27
|
-
beforeEach(async () => {
|
|
28
|
-
tempDir = await fs.mkdtemp(path.join(os.tmpdir(), "minimem-hooks-test-"));
|
|
29
|
-
originalHome = process.env.HOME!;
|
|
30
|
-
// Use a fake HOME so global config doesn't interfere
|
|
31
|
-
process.env.HOME = tempDir;
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
afterEach(async () => {
|
|
35
|
-
process.env.HOME = originalHome;
|
|
36
|
-
await fs.rm(tempDir, { recursive: true, force: true });
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Run a hook script in a given working directory.
|
|
41
|
-
* Returns exit code (0 = success/early-exit, non-zero = error).
|
|
42
|
-
* We pipe empty JSON as stdin since hooks expect input.
|
|
43
|
-
*/
|
|
44
|
-
function runHook(
|
|
45
|
-
script: string,
|
|
46
|
-
cwd: string,
|
|
47
|
-
stdinData = "{}",
|
|
48
|
-
): { exitCode: number; stdout: string; stderr: string } {
|
|
49
|
-
try {
|
|
50
|
-
const stdout = execSync(`echo '${stdinData}' | bash "${script}"`, {
|
|
51
|
-
cwd,
|
|
52
|
-
env: { ...process.env, HOME: tempDir },
|
|
53
|
-
timeout: 10_000,
|
|
54
|
-
encoding: "utf-8",
|
|
55
|
-
stdio: ["pipe", "pipe", "pipe"],
|
|
56
|
-
});
|
|
57
|
-
return { exitCode: 0, stdout: stdout.toString(), stderr: "" };
|
|
58
|
-
} catch (err: unknown) {
|
|
59
|
-
const e = err as { status?: number; stdout?: string; stderr?: string };
|
|
60
|
-
return {
|
|
61
|
-
exitCode: e.status ?? 1,
|
|
62
|
-
stdout: (e.stdout ?? "").toString(),
|
|
63
|
-
stderr: (e.stderr ?? "").toString(),
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
describe("session-start hook", () => {
|
|
69
|
-
const script = path.join(HOOKS_DIR, "session-start.sh");
|
|
70
|
-
|
|
71
|
-
it("should exit early when no .minimem directories exist", () => {
|
|
72
|
-
const result = runHook(script, tempDir);
|
|
73
|
-
assert.strictEqual(result.exitCode, 0);
|
|
74
|
-
assert.strictEqual(result.stdout.trim(), "");
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
it("should exit early when hooks.sessionStart is not set (defaults to false)", async () => {
|
|
78
|
-
// Create local .minimem with config but no hooks setting
|
|
79
|
-
const configDir = path.join(tempDir, ".minimem");
|
|
80
|
-
await fs.mkdir(configDir, { recursive: true });
|
|
81
|
-
await fs.writeFile(
|
|
82
|
-
path.join(configDir, "config.json"),
|
|
83
|
-
JSON.stringify({ embedding: { provider: "auto" } }),
|
|
84
|
-
);
|
|
85
|
-
|
|
86
|
-
const result = runHook(script, tempDir);
|
|
87
|
-
assert.strictEqual(result.exitCode, 0);
|
|
88
|
-
// Should produce no output (exited before search)
|
|
89
|
-
assert.strictEqual(result.stdout.trim(), "");
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
it("should exit early when hooks.sessionStart is false in local config", async () => {
|
|
93
|
-
const configDir = path.join(tempDir, ".minimem");
|
|
94
|
-
await fs.mkdir(configDir, { recursive: true });
|
|
95
|
-
await fs.writeFile(
|
|
96
|
-
path.join(configDir, "config.json"),
|
|
97
|
-
JSON.stringify({ hooks: { sessionStart: false } }),
|
|
98
|
-
);
|
|
99
|
-
|
|
100
|
-
const result = runHook(script, tempDir);
|
|
101
|
-
assert.strictEqual(result.exitCode, 0);
|
|
102
|
-
assert.strictEqual(result.stdout.trim(), "");
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
it("should exit early when hooks.sessionStart is false in global config", async () => {
|
|
106
|
-
// Create global config at $HOME/.minimem/.minimem/config.json
|
|
107
|
-
const globalConfigDir = path.join(tempDir, ".minimem", ".minimem");
|
|
108
|
-
await fs.mkdir(globalConfigDir, { recursive: true });
|
|
109
|
-
await fs.writeFile(
|
|
110
|
-
path.join(globalConfigDir, "config.json"),
|
|
111
|
-
JSON.stringify({ hooks: { sessionStart: false } }),
|
|
112
|
-
);
|
|
113
|
-
|
|
114
|
-
const result = runHook(script, tempDir);
|
|
115
|
-
assert.strictEqual(result.exitCode, 0);
|
|
116
|
-
assert.strictEqual(result.stdout.trim(), "");
|
|
117
|
-
});
|
|
118
|
-
|
|
119
|
-
it("should allow local config to override global config (local true, global false)", async () => {
|
|
120
|
-
// Global: disabled
|
|
121
|
-
const globalConfigDir = path.join(tempDir, ".minimem", ".minimem");
|
|
122
|
-
await fs.mkdir(globalConfigDir, { recursive: true });
|
|
123
|
-
await fs.writeFile(
|
|
124
|
-
path.join(globalConfigDir, "config.json"),
|
|
125
|
-
JSON.stringify({ hooks: { sessionStart: false } }),
|
|
126
|
-
);
|
|
127
|
-
|
|
128
|
-
// Local: enabled — script should proceed past config check
|
|
129
|
-
// (it will fail at npx minimem search, but that's expected)
|
|
130
|
-
const localConfigDir = path.join(tempDir, ".minimem");
|
|
131
|
-
await fs.writeFile(
|
|
132
|
-
path.join(localConfigDir, "config.json"),
|
|
133
|
-
JSON.stringify({ hooks: { sessionStart: true } }),
|
|
134
|
-
);
|
|
135
|
-
|
|
136
|
-
const result = runHook(script, tempDir);
|
|
137
|
-
// Script proceeds past config check. It will exit 0 because
|
|
138
|
-
// the npx search failure is caught with || true
|
|
139
|
-
assert.strictEqual(result.exitCode, 0);
|
|
140
|
-
});
|
|
141
|
-
|
|
142
|
-
it("should allow local config to override global config (local false, global true)", async () => {
|
|
143
|
-
// Global: enabled
|
|
144
|
-
const globalConfigDir = path.join(tempDir, ".minimem", ".minimem");
|
|
145
|
-
await fs.mkdir(globalConfigDir, { recursive: true });
|
|
146
|
-
await fs.writeFile(
|
|
147
|
-
path.join(globalConfigDir, "config.json"),
|
|
148
|
-
JSON.stringify({ hooks: { sessionStart: true } }),
|
|
149
|
-
);
|
|
150
|
-
|
|
151
|
-
// Local: disabled
|
|
152
|
-
const localConfigDir = path.join(tempDir, ".minimem");
|
|
153
|
-
await fs.writeFile(
|
|
154
|
-
path.join(localConfigDir, "config.json"),
|
|
155
|
-
JSON.stringify({ hooks: { sessionStart: false } }),
|
|
156
|
-
);
|
|
157
|
-
|
|
158
|
-
const result = runHook(script, tempDir);
|
|
159
|
-
assert.strictEqual(result.exitCode, 0);
|
|
160
|
-
// Should exit early — no search output
|
|
161
|
-
assert.strictEqual(result.stdout.trim(), "");
|
|
162
|
-
});
|
|
163
|
-
});
|
|
164
|
-
|
|
165
|
-
describe("session-end hook", () => {
|
|
166
|
-
const script = path.join(HOOKS_DIR, "session-end.sh");
|
|
167
|
-
|
|
168
|
-
it("should exit early when no .minimem directories exist", () => {
|
|
169
|
-
const result = runHook(script, tempDir);
|
|
170
|
-
assert.strictEqual(result.exitCode, 0);
|
|
171
|
-
assert.strictEqual(result.stdout.trim(), "");
|
|
172
|
-
});
|
|
173
|
-
|
|
174
|
-
it("should exit early when hooks.sessionEnd is not set (defaults to false)", async () => {
|
|
175
|
-
const configDir = path.join(tempDir, ".minimem");
|
|
176
|
-
await fs.mkdir(configDir, { recursive: true });
|
|
177
|
-
await fs.writeFile(
|
|
178
|
-
path.join(configDir, "config.json"),
|
|
179
|
-
JSON.stringify({ embedding: { provider: "auto" } }),
|
|
180
|
-
);
|
|
181
|
-
|
|
182
|
-
const result = runHook(script, tempDir);
|
|
183
|
-
assert.strictEqual(result.exitCode, 0);
|
|
184
|
-
assert.strictEqual(result.stdout.trim(), "");
|
|
185
|
-
});
|
|
186
|
-
|
|
187
|
-
it("should exit early when hooks.sessionEnd is false in local config", async () => {
|
|
188
|
-
const configDir = path.join(tempDir, ".minimem");
|
|
189
|
-
await fs.mkdir(configDir, { recursive: true });
|
|
190
|
-
await fs.writeFile(
|
|
191
|
-
path.join(configDir, "config.json"),
|
|
192
|
-
JSON.stringify({ hooks: { sessionEnd: false } }),
|
|
193
|
-
);
|
|
194
|
-
|
|
195
|
-
const result = runHook(script, tempDir);
|
|
196
|
-
assert.strictEqual(result.exitCode, 0);
|
|
197
|
-
assert.strictEqual(result.stdout.trim(), "");
|
|
198
|
-
});
|
|
199
|
-
|
|
200
|
-
it("should exit early when hooks.sessionEnd is false in global config", async () => {
|
|
201
|
-
const globalConfigDir = path.join(tempDir, ".minimem", ".minimem");
|
|
202
|
-
await fs.mkdir(globalConfigDir, { recursive: true });
|
|
203
|
-
await fs.writeFile(
|
|
204
|
-
path.join(globalConfigDir, "config.json"),
|
|
205
|
-
JSON.stringify({ hooks: { sessionEnd: false } }),
|
|
206
|
-
);
|
|
207
|
-
|
|
208
|
-
const result = runHook(script, tempDir);
|
|
209
|
-
assert.strictEqual(result.exitCode, 0);
|
|
210
|
-
assert.strictEqual(result.stdout.trim(), "");
|
|
211
|
-
});
|
|
212
|
-
|
|
213
|
-
it("should allow local config to override global config (local true, global false)", async () => {
|
|
214
|
-
// Global: disabled
|
|
215
|
-
const globalConfigDir = path.join(tempDir, ".minimem", ".minimem");
|
|
216
|
-
await fs.mkdir(globalConfigDir, { recursive: true });
|
|
217
|
-
await fs.writeFile(
|
|
218
|
-
path.join(globalConfigDir, "config.json"),
|
|
219
|
-
JSON.stringify({ hooks: { sessionEnd: false } }),
|
|
220
|
-
);
|
|
221
|
-
|
|
222
|
-
// Local: enabled
|
|
223
|
-
const localConfigDir = path.join(tempDir, ".minimem");
|
|
224
|
-
await fs.writeFile(
|
|
225
|
-
path.join(localConfigDir, "config.json"),
|
|
226
|
-
JSON.stringify({ hooks: { sessionEnd: true } }),
|
|
227
|
-
);
|
|
228
|
-
|
|
229
|
-
const result = runHook(script, tempDir);
|
|
230
|
-
// Script proceeds past config check — npx append will fail but is caught
|
|
231
|
-
assert.strictEqual(result.exitCode, 0);
|
|
232
|
-
});
|
|
233
|
-
|
|
234
|
-
it("should allow local config to override global config (local false, global true)", async () => {
|
|
235
|
-
// Global: enabled
|
|
236
|
-
const globalConfigDir = path.join(tempDir, ".minimem", ".minimem");
|
|
237
|
-
await fs.mkdir(globalConfigDir, { recursive: true });
|
|
238
|
-
await fs.writeFile(
|
|
239
|
-
path.join(globalConfigDir, "config.json"),
|
|
240
|
-
JSON.stringify({ hooks: { sessionEnd: true } }),
|
|
241
|
-
);
|
|
242
|
-
|
|
243
|
-
// Local: disabled
|
|
244
|
-
const localConfigDir = path.join(tempDir, ".minimem");
|
|
245
|
-
await fs.writeFile(
|
|
246
|
-
path.join(localConfigDir, "config.json"),
|
|
247
|
-
JSON.stringify({ hooks: { sessionEnd: false } }),
|
|
248
|
-
);
|
|
249
|
-
|
|
250
|
-
const result = runHook(script, tempDir);
|
|
251
|
-
assert.strictEqual(result.exitCode, 0);
|
|
252
|
-
assert.strictEqual(result.stdout.trim(), "");
|
|
253
|
-
});
|
|
254
|
-
|
|
255
|
-
it("should exit early when stop_hook_active is true", async () => {
|
|
256
|
-
const configDir = path.join(tempDir, ".minimem");
|
|
257
|
-
await fs.mkdir(configDir, { recursive: true });
|
|
258
|
-
await fs.writeFile(
|
|
259
|
-
path.join(configDir, "config.json"),
|
|
260
|
-
JSON.stringify({ hooks: { sessionEnd: true } }),
|
|
261
|
-
);
|
|
262
|
-
|
|
263
|
-
const result = runHook(
|
|
264
|
-
script,
|
|
265
|
-
tempDir,
|
|
266
|
-
JSON.stringify({ stop_hook_active: true }),
|
|
267
|
-
);
|
|
268
|
-
assert.strictEqual(result.exitCode, 0);
|
|
269
|
-
assert.strictEqual(result.stdout.trim(), "");
|
|
270
|
-
});
|
|
271
|
-
});
|
|
272
|
-
});
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"hooks": {
|
|
3
|
-
"SessionStart": [
|
|
4
|
-
{
|
|
5
|
-
"matcher": "startup|resume",
|
|
6
|
-
"hooks": [
|
|
7
|
-
{
|
|
8
|
-
"type": "command",
|
|
9
|
-
"command": "${CLAUDE_PLUGIN_ROOT}/hooks/session-start.sh",
|
|
10
|
-
"timeout": 10
|
|
11
|
-
}
|
|
12
|
-
]
|
|
13
|
-
}
|
|
14
|
-
],
|
|
15
|
-
"Stop": [
|
|
16
|
-
{
|
|
17
|
-
"hooks": [
|
|
18
|
-
{
|
|
19
|
-
"type": "command",
|
|
20
|
-
"command": "${CLAUDE_PLUGIN_ROOT}/hooks/session-end.sh",
|
|
21
|
-
"timeout": 15
|
|
22
|
-
}
|
|
23
|
-
]
|
|
24
|
-
}
|
|
25
|
-
]
|
|
26
|
-
}
|
|
27
|
-
}
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
# minimem SessionEnd (Stop) hook
|
|
3
|
-
# Auto-summarizes the session by appending a note to today's daily log.
|
|
4
|
-
# Uses the transcript path to determine what was worked on.
|
|
5
|
-
|
|
6
|
-
set -euo pipefail
|
|
7
|
-
|
|
8
|
-
# Read hook input from stdin
|
|
9
|
-
INPUT=$(cat)
|
|
10
|
-
|
|
11
|
-
# Prevent infinite loops: if stop hook is already active, exit
|
|
12
|
-
STOP_ACTIVE=$(echo "$INPUT" | node -e "
|
|
13
|
-
const d = JSON.parse(require('fs').readFileSync('/dev/stdin','utf-8'));
|
|
14
|
-
console.log(d.stop_hook_active ? 'true' : 'false');
|
|
15
|
-
" 2>/dev/null) || echo "false"
|
|
16
|
-
|
|
17
|
-
if [ "$STOP_ACTIVE" = "true" ]; then
|
|
18
|
-
exit 0
|
|
19
|
-
fi
|
|
20
|
-
|
|
21
|
-
# Only proceed if minimem is initialized (local or global)
|
|
22
|
-
HAS_LOCAL=""
|
|
23
|
-
HAS_GLOBAL=""
|
|
24
|
-
if [ -d ".minimem" ]; then
|
|
25
|
-
HAS_LOCAL="1"
|
|
26
|
-
fi
|
|
27
|
-
if [ -d "$HOME/.minimem" ]; then
|
|
28
|
-
HAS_GLOBAL="1"
|
|
29
|
-
fi
|
|
30
|
-
|
|
31
|
-
if [ -z "$HAS_LOCAL" ] && [ -z "$HAS_GLOBAL" ]; then
|
|
32
|
-
exit 0
|
|
33
|
-
fi
|
|
34
|
-
|
|
35
|
-
# Check config to see if this hook is enabled (defaults to true)
|
|
36
|
-
HOOK_ENABLED=$(node -e "
|
|
37
|
-
const fs = require('fs');
|
|
38
|
-
const path = require('path');
|
|
39
|
-
const configs = [];
|
|
40
|
-
try { configs.push(JSON.parse(fs.readFileSync(path.join(process.env.HOME, '.minimem', '.minimem', 'config.json'), 'utf-8'))); } catch {}
|
|
41
|
-
try { configs.push(JSON.parse(fs.readFileSync('.minimem/config.json', 'utf-8'))); } catch {}
|
|
42
|
-
// Last config wins (local overrides global)
|
|
43
|
-
for (const c of configs.reverse()) {
|
|
44
|
-
if (c.hooks && typeof c.hooks.sessionEnd === 'boolean') {
|
|
45
|
-
console.log(c.hooks.sessionEnd ? 'true' : 'false');
|
|
46
|
-
process.exit(0);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
console.log('false');
|
|
50
|
-
" 2>/dev/null) || echo "false"
|
|
51
|
-
|
|
52
|
-
if [ "$HOOK_ENABLED" = "false" ]; then
|
|
53
|
-
exit 0
|
|
54
|
-
fi
|
|
55
|
-
|
|
56
|
-
# Extract session info from hook input
|
|
57
|
-
SESSION_ID=$(echo "$INPUT" | node -e "
|
|
58
|
-
const d = JSON.parse(require('fs').readFileSync('/dev/stdin','utf-8'));
|
|
59
|
-
console.log(d.session_id || 'unknown');
|
|
60
|
-
" 2>/dev/null) || echo "unknown"
|
|
61
|
-
|
|
62
|
-
CWD=$(echo "$INPUT" | node -e "
|
|
63
|
-
const d = JSON.parse(require('fs').readFileSync('/dev/stdin','utf-8'));
|
|
64
|
-
console.log(d.cwd || process.cwd());
|
|
65
|
-
" 2>/dev/null) || pwd
|
|
66
|
-
|
|
67
|
-
PROJECT_NAME=$(basename "$CWD")
|
|
68
|
-
TIMESTAMP=$(date +"%Y-%m-%d %H:%M")
|
|
69
|
-
|
|
70
|
-
# Build append args
|
|
71
|
-
APPEND_ARGS=("append")
|
|
72
|
-
if [ -n "$HAS_LOCAL" ]; then
|
|
73
|
-
APPEND_ARGS+=("--dir" ".")
|
|
74
|
-
elif [ -n "$HAS_GLOBAL" ]; then
|
|
75
|
-
APPEND_ARGS+=("--global")
|
|
76
|
-
fi
|
|
77
|
-
|
|
78
|
-
# Create a session end marker in memory
|
|
79
|
-
# The content is intentionally brief — Claude Code's transcript has the full details.
|
|
80
|
-
ENTRY="### ${TIMESTAMP} (session: ${SESSION_ID})
|
|
81
|
-
<!-- type: context -->
|
|
82
|
-
Session ended in project: ${PROJECT_NAME} (${CWD})"
|
|
83
|
-
|
|
84
|
-
npx --yes minimem "${APPEND_ARGS[@]}" "$ENTRY" 2>/dev/null || true
|
|
85
|
-
|
|
86
|
-
exit 0
|