@selesai/code 0.13.0 → 0.13.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/CHANGELOG.md +22 -0
- package/dist/core/agent-session.d.ts +1 -1
- package/dist/core/agent-session.js +1 -1
- package/dist/core/sdk.d.ts +2 -2
- package/dist/core/sdk.js +1 -1
- package/dist/core/system-prompt.d.ts +1 -1
- package/dist/core/system-prompt.js +1 -1
- package/dist/extensions/package.json +1 -2
- package/dist/extensions/pi-hermes-memory/CHANGELOG.md +371 -0
- package/dist/extensions/pi-hermes-memory/LICENSE +21 -0
- package/dist/extensions/pi-hermes-memory/README.md +643 -0
- package/dist/extensions/pi-hermes-memory/docs/0.1/TASKS.md +197 -0
- package/dist/extensions/pi-hermes-memory/docs/0.2/PLAN.md +290 -0
- package/dist/extensions/pi-hermes-memory/docs/0.2/TASKS.md +134 -0
- package/dist/extensions/pi-hermes-memory/docs/0.2/TEST-PLAN.md +216 -0
- package/dist/extensions/pi-hermes-memory/docs/0.3/PLAN.md +330 -0
- package/dist/extensions/pi-hermes-memory/docs/0.3/TASKS.md +125 -0
- package/dist/extensions/pi-hermes-memory/docs/0.4/PLAN.md +160 -0
- package/dist/extensions/pi-hermes-memory/docs/0.4/TASKS.md +113 -0
- package/dist/extensions/pi-hermes-memory/docs/0.6/CHANGELOG.md +57 -0
- package/dist/extensions/pi-hermes-memory/docs/0.6/PLAN.md +202 -0
- package/dist/extensions/pi-hermes-memory/docs/0.6/TASKS.md +144 -0
- package/dist/extensions/pi-hermes-memory/docs/0.7/PLAN.md +349 -0
- package/dist/extensions/pi-hermes-memory/docs/0.7/TASKS.md +110 -0
- package/dist/extensions/pi-hermes-memory/docs/PUBLISHING.md +149 -0
- package/dist/extensions/pi-hermes-memory/docs/ROADMAP.md +468 -0
- package/dist/extensions/pi-hermes-memory/docs/images/memory-architecture.svg +1 -0
- package/dist/extensions/pi-hermes-memory/docs/images/pi-logo.svg +22 -0
- package/dist/extensions/pi-hermes-memory/docs/images/pi_memory.png +0 -0
- package/dist/extensions/pi-hermes-memory/docs/images/pi_memory.svg +19 -0
- package/dist/extensions/pi-hermes-memory/docs/images/security-flow.svg +1 -0
- package/dist/extensions/pi-hermes-memory/docs/images/session-lifecycle.svg +1 -0
- package/dist/extensions/pi-hermes-memory/docs/images/source-architecture.svg +1 -0
- package/dist/extensions/pi-hermes-memory/docs/mermaid/memory-architecture.mmd +49 -0
- package/dist/extensions/pi-hermes-memory/docs/mermaid/security-flow.mmd +40 -0
- package/dist/extensions/pi-hermes-memory/docs/mermaid/session-lifecycle.mmd +56 -0
- package/dist/extensions/pi-hermes-memory/docs/mermaid/source-architecture.mmd +54 -0
- package/dist/extensions/pi-hermes-memory/package-lock.json +3799 -0
- package/dist/extensions/pi-hermes-memory/package.json +66 -0
- package/dist/extensions/pi-hermes-memory/scripts/check-min-sdk.mjs +99 -0
- package/dist/extensions/pi-hermes-memory/scripts/ensure-dev.mjs +57 -0
- package/dist/extensions/pi-hermes-memory/src/auto-consolidation-warning.ts +6 -0
- package/dist/extensions/pi-hermes-memory/src/config.ts +178 -0
- package/dist/extensions/pi-hermes-memory/src/constants.ts +424 -0
- package/dist/extensions/pi-hermes-memory/src/extension-root-migration.ts +639 -0
- package/dist/extensions/pi-hermes-memory/src/handlers/auto-consolidate.ts +401 -0
- package/dist/extensions/pi-hermes-memory/src/handlers/background-review.ts +297 -0
- package/dist/extensions/pi-hermes-memory/src/handlers/child-process-watchdog.mjs +90 -0
- package/dist/extensions/pi-hermes-memory/src/handlers/correction-detector.ts +300 -0
- package/dist/extensions/pi-hermes-memory/src/handlers/index-sessions.ts +86 -0
- package/dist/extensions/pi-hermes-memory/src/handlers/insights.ts +78 -0
- package/dist/extensions/pi-hermes-memory/src/handlers/interview.ts +37 -0
- package/dist/extensions/pi-hermes-memory/src/handlers/learn-memory.ts +186 -0
- package/dist/extensions/pi-hermes-memory/src/handlers/message-parts.ts +27 -0
- package/dist/extensions/pi-hermes-memory/src/handlers/pi-child-process.ts +485 -0
- package/dist/extensions/pi-hermes-memory/src/handlers/preview-context.ts +105 -0
- package/dist/extensions/pi-hermes-memory/src/handlers/review-memory-ops.ts +506 -0
- package/dist/extensions/pi-hermes-memory/src/handlers/session-backfill.ts +145 -0
- package/dist/extensions/pi-hermes-memory/src/handlers/session-flush.ts +151 -0
- package/dist/extensions/pi-hermes-memory/src/handlers/session-live-index.ts +94 -0
- package/dist/extensions/pi-hermes-memory/src/handlers/skills-command.ts +1334 -0
- package/dist/extensions/pi-hermes-memory/src/handlers/standing-pin.ts +111 -0
- package/dist/extensions/pi-hermes-memory/src/handlers/switch-project.ts +75 -0
- package/dist/extensions/pi-hermes-memory/src/handlers/sync-markdown-memories.ts +266 -0
- package/dist/extensions/pi-hermes-memory/src/index.ts +378 -0
- package/dist/extensions/pi-hermes-memory/src/lifecycle-timing.ts +54 -0
- package/dist/extensions/pi-hermes-memory/src/paths.ts +61 -0
- package/dist/extensions/pi-hermes-memory/src/project-context.ts +13 -0
- package/dist/extensions/pi-hermes-memory/src/project-memory-migration.ts +93 -0
- package/dist/extensions/pi-hermes-memory/src/project.ts +157 -0
- package/dist/extensions/pi-hermes-memory/src/prompt-context.ts +55 -0
- package/dist/extensions/pi-hermes-memory/src/store/atomic-lock-coordinator.ts +375 -0
- package/dist/extensions/pi-hermes-memory/src/store/canonical-storage-path.ts +54 -0
- package/dist/extensions/pi-hermes-memory/src/store/content-scanner.ts +101 -0
- package/dist/extensions/pi-hermes-memory/src/store/db.ts +1180 -0
- package/dist/extensions/pi-hermes-memory/src/store/fts-query.ts +101 -0
- package/dist/extensions/pi-hermes-memory/src/store/markdown-mutation-lock.ts +38 -0
- package/dist/extensions/pi-hermes-memory/src/store/memory-lookup.ts +24 -0
- package/dist/extensions/pi-hermes-memory/src/store/memory-store.ts +1191 -0
- package/dist/extensions/pi-hermes-memory/src/store/recovery-maintenance.ts +66 -0
- package/dist/extensions/pi-hermes-memory/src/store/schema.ts +118 -0
- package/dist/extensions/pi-hermes-memory/src/store/session-anchor-search.ts +472 -0
- package/dist/extensions/pi-hermes-memory/src/store/session-indexer.ts +511 -0
- package/dist/extensions/pi-hermes-memory/src/store/session-parser.ts +213 -0
- package/dist/extensions/pi-hermes-memory/src/store/session-search.ts +234 -0
- package/dist/extensions/pi-hermes-memory/src/store/skill-store.ts +950 -0
- package/dist/extensions/pi-hermes-memory/src/store/skill-utils.ts +133 -0
- package/dist/extensions/pi-hermes-memory/src/store/sqlite-memory-store.ts +1002 -0
- package/dist/extensions/pi-hermes-memory/src/store/sqlite-native.ts +241 -0
- package/dist/extensions/pi-hermes-memory/src/store/standing-instructions.ts +247 -0
- package/dist/extensions/pi-hermes-memory/src/tools/memory-search-tool.ts +95 -0
- package/dist/extensions/pi-hermes-memory/src/tools/memory-tool.ts +469 -0
- package/dist/extensions/pi-hermes-memory/src/tools/session-search-tool.ts +246 -0
- package/dist/extensions/pi-hermes-memory/src/tools/shared-output-view.ts +170 -0
- package/dist/extensions/pi-hermes-memory/src/tools/skill-tool.ts +333 -0
- package/dist/extensions/pi-hermes-memory/src/tools/tool-result-views.ts +105 -0
- package/dist/extensions/pi-hermes-memory/src/types.ts +214 -0
- package/dist/extensions/pi-hermes-memory/tests/config.test.ts +434 -0
- package/dist/extensions/pi-hermes-memory/tests/extension-root-migration.test.ts +368 -0
- package/dist/extensions/pi-hermes-memory/tests/handlers/auto-consolidate.test.ts +984 -0
- package/dist/extensions/pi-hermes-memory/tests/handlers/background-review.test.ts +950 -0
- package/dist/extensions/pi-hermes-memory/tests/handlers/correction-detector.test.ts +671 -0
- package/dist/extensions/pi-hermes-memory/tests/handlers/insights.test.ts +157 -0
- package/dist/extensions/pi-hermes-memory/tests/handlers/interview.test.ts +127 -0
- package/dist/extensions/pi-hermes-memory/tests/handlers/pi-child-process.test.ts +905 -0
- package/dist/extensions/pi-hermes-memory/tests/handlers/preview-context.test.ts +152 -0
- package/dist/extensions/pi-hermes-memory/tests/handlers/prompt-context.test.ts +166 -0
- package/dist/extensions/pi-hermes-memory/tests/handlers/resources-discover.test.ts +71 -0
- package/dist/extensions/pi-hermes-memory/tests/handlers/review-memory-ops.test.ts +614 -0
- package/dist/extensions/pi-hermes-memory/tests/handlers/session-backfill.test.ts +192 -0
- package/dist/extensions/pi-hermes-memory/tests/handlers/session-flush.test.ts +677 -0
- package/dist/extensions/pi-hermes-memory/tests/handlers/session-live-index.test.ts +225 -0
- package/dist/extensions/pi-hermes-memory/tests/handlers/skills-command.test.ts +827 -0
- package/dist/extensions/pi-hermes-memory/tests/handlers/standing-pin.test.ts +134 -0
- package/dist/extensions/pi-hermes-memory/tests/handlers/sync-markdown-memories.test.ts +491 -0
- package/dist/extensions/pi-hermes-memory/tests/handlers/system-prompt.test.ts +199 -0
- package/dist/extensions/pi-hermes-memory/tests/handlers/thinking-max.test.ts +64 -0
- package/dist/extensions/pi-hermes-memory/tests/index.test.ts +30 -0
- package/dist/extensions/pi-hermes-memory/tests/integration/flow.test.ts +126 -0
- package/dist/extensions/pi-hermes-memory/tests/lifecycle-timing.test.ts +76 -0
- package/dist/extensions/pi-hermes-memory/tests/paths.test.ts +23 -0
- package/dist/extensions/pi-hermes-memory/tests/project-memory-migration.test.ts +80 -0
- package/dist/extensions/pi-hermes-memory/tests/project-rebinding.test.ts +115 -0
- package/dist/extensions/pi-hermes-memory/tests/project.test.ts +120 -0
- package/dist/extensions/pi-hermes-memory/tests/run-all-timeout.test.ts +107 -0
- package/dist/extensions/pi-hermes-memory/tests/run-all.sh +45 -0
- package/dist/extensions/pi-hermes-memory/tests/store/atomic-lock-coordinator.test.ts +381 -0
- package/dist/extensions/pi-hermes-memory/tests/store/content-scanner.test.ts +388 -0
- package/dist/extensions/pi-hermes-memory/tests/store/db.test.ts +1046 -0
- package/dist/extensions/pi-hermes-memory/tests/store/markdown-mutation-lock.test.ts +34 -0
- package/dist/extensions/pi-hermes-memory/tests/store/memory-store.test.ts +2150 -0
- package/dist/extensions/pi-hermes-memory/tests/store/recovery-maintenance.test.ts +170 -0
- package/dist/extensions/pi-hermes-memory/tests/store/session-anchor-search.test.ts +210 -0
- package/dist/extensions/pi-hermes-memory/tests/store/session-indexer.test.ts +643 -0
- package/dist/extensions/pi-hermes-memory/tests/store/session-parser.test.ts +282 -0
- package/dist/extensions/pi-hermes-memory/tests/store/session-search.test.ts +287 -0
- package/dist/extensions/pi-hermes-memory/tests/store/skill-store.test.ts +678 -0
- package/dist/extensions/pi-hermes-memory/tests/store/skill-utils.test.ts +21 -0
- package/dist/extensions/pi-hermes-memory/tests/store/sqlite-lazy-load.test.ts +78 -0
- package/dist/extensions/pi-hermes-memory/tests/store/sqlite-memory-store.test.ts +543 -0
- package/dist/extensions/pi-hermes-memory/tests/store/sqlite-native.test.ts +164 -0
- package/dist/extensions/pi-hermes-memory/tests/store/standing-instructions.test.ts +171 -0
- package/dist/extensions/pi-hermes-memory/tests/tools/memory-search-tool.test.ts +84 -0
- package/dist/extensions/pi-hermes-memory/tests/tools/memory-tool.test.ts +709 -0
- package/dist/extensions/pi-hermes-memory/tests/tools/session-search-tool.test.ts +345 -0
- package/dist/extensions/pi-hermes-memory/tests/tools/shared-output-view.test.ts +362 -0
- package/dist/extensions/pi-hermes-memory/tests/tools/skill-tool.test.ts +478 -0
- package/dist/extensions/pi-hermes-memory/tests/tools/tool-result-renderer-wiring.test.ts +40 -0
- package/dist/extensions/pi-hermes-memory/tsconfig.json +19 -0
- package/dist/extensions/pi-rewind-hook/README.md +4 -1
- package/dist/extensions/pi-rewind-hook/index.ts +151 -21
- package/dist/extensions/pi-rewind-hook/package.json +5 -3
- package/dist/extensions/pi-subagents/.oxlintrc.json +43 -0
- package/dist/extensions/pi-subagents/AGENTS.md +5 -0
- package/dist/extensions/pi-subagents/CHANGELOG.md +157 -0
- package/dist/extensions/pi-subagents/README.md +12 -6
- package/dist/extensions/pi-subagents/VISION.md +81 -0
- package/dist/extensions/pi-subagents/agents/claude-code-writer.md +15 -0
- package/dist/extensions/pi-subagents/agents/claude-code.md +15 -0
- package/dist/extensions/pi-subagents/agents/codex-exec-writer.md +15 -0
- package/dist/extensions/pi-subagents/agents/codex-exec.md +15 -0
- package/dist/extensions/pi-subagents/agents/cursor-agent-writer.md +14 -0
- package/dist/extensions/pi-subagents/agents/cursor-agent.md +14 -0
- package/dist/extensions/pi-subagents/agents/reviewer.md +1 -3
- package/dist/extensions/pi-subagents/docs/agents.md +488 -0
- package/dist/extensions/pi-subagents/docs/configuration.md +46 -9
- package/dist/extensions/pi-subagents/docs/extension-api.md +42 -3
- package/dist/extensions/pi-subagents/docs/models.md +27 -4
- package/dist/extensions/pi-subagents/docs/observability.md +10 -9
- package/dist/extensions/pi-subagents/docs/tool-reference.md +102 -6
- package/dist/extensions/pi-subagents/docs/workflows.md +135 -0
- package/dist/extensions/pi-subagents/package-lock.json +389 -2
- package/dist/extensions/pi-subagents/package.json +3 -1
- package/dist/extensions/pi-subagents/prompts/review-loop.md +2 -2
- package/dist/extensions/pi-subagents/skills/council-mode/SKILL.md +1 -1
- package/dist/extensions/pi-subagents/skills/pi-subagents/SKILL.md +3 -1
- package/dist/extensions/pi-subagents/skills/pi-subagents/references/execution-controls.md +7 -3
- package/dist/extensions/pi-subagents/skills/pi-subagents/references/management-authoring-rpc.md +2 -2
- package/dist/extensions/pi-subagents/skills/pi-subagents/references/prompting-and-roles.md +26 -5
- package/dist/extensions/pi-subagents/src/agents/agent-management.ts +41 -22
- package/dist/extensions/pi-subagents/src/agents/agent-refinements.ts +4 -4
- package/dist/extensions/pi-subagents/src/agents/agent-serializer.ts +9 -2
- package/dist/extensions/pi-subagents/src/agents/agents.ts +322 -75
- package/dist/extensions/pi-subagents/src/agents/builtin-names.ts +6 -0
- package/dist/extensions/pi-subagents/src/agents/runtime-agent-events.ts +70 -0
- package/dist/extensions/pi-subagents/src/agents/runtime-agent-registry.ts +27 -20
- package/dist/extensions/pi-subagents/src/api/agents.ts +10 -5
- package/dist/extensions/pi-subagents/src/api/background-work.ts +5 -1
- package/dist/extensions/pi-subagents/src/api/delegation.ts +0 -7
- package/dist/extensions/pi-subagents/src/api/preflight.ts +34 -12
- package/dist/extensions/pi-subagents/src/extension/config.ts +70 -0
- package/dist/extensions/pi-subagents/src/extension/doctor.ts +3 -3
- package/dist/extensions/pi-subagents/src/extension/fanout-child.ts +5 -3
- package/dist/extensions/pi-subagents/src/extension/index.ts +83 -30
- package/dist/extensions/pi-subagents/src/extension/public-execution.ts +44 -15
- package/dist/extensions/pi-subagents/src/extension/rpc.ts +55 -19
- package/dist/extensions/pi-subagents/src/extension/schemas.ts +41 -15
- package/dist/extensions/pi-subagents/src/extension/tool-description.ts +28 -31
- package/dist/extensions/pi-subagents/src/inspectors/herdr/actions.ts +2 -1
- package/dist/extensions/pi-subagents/src/inspectors/herdr/inspector-runner.ts +2 -10
- package/dist/extensions/pi-subagents/src/inspectors/herdr/session-roots-codec.ts +42 -0
- package/dist/extensions/pi-subagents/src/integrations/herdr-status.ts +51 -7
- package/dist/extensions/pi-subagents/src/intercom/result-intercom.ts +2 -0
- package/dist/extensions/pi-subagents/src/profiles/profiles.ts +5 -6
- package/dist/extensions/pi-subagents/src/runs/background/active-async-capacity.ts +77 -10
- package/dist/extensions/pi-subagents/src/runs/background/async-execution.ts +176 -53
- package/dist/extensions/pi-subagents/src/runs/background/async-job-tracker.ts +19 -12
- package/dist/extensions/pi-subagents/src/runs/background/async-resume.ts +29 -27
- package/dist/extensions/pi-subagents/src/runs/background/async-retention.ts +20 -3
- package/dist/extensions/pi-subagents/src/runs/background/async-status-snapshot.ts +23 -261
- package/dist/extensions/pi-subagents/src/runs/background/async-status.ts +73 -7
- package/dist/extensions/pi-subagents/src/runs/background/chain-append.ts +8 -3
- package/dist/extensions/pi-subagents/src/runs/background/chain-root-attachment.ts +74 -8
- package/dist/extensions/pi-subagents/src/runs/background/fleet-view.ts +37 -21
- package/dist/extensions/pi-subagents/src/runs/background/inspect-rpc.ts +8 -8
- package/dist/extensions/pi-subagents/src/runs/background/notify.ts +184 -9
- package/dist/extensions/pi-subagents/src/runs/background/result-delivery-ownership.ts +45 -0
- package/dist/extensions/pi-subagents/src/runs/background/result-files.ts +28 -14
- package/dist/extensions/pi-subagents/src/runs/background/result-watcher.ts +38 -15
- package/dist/extensions/pi-subagents/src/runs/background/resume-guidance.ts +1 -1
- package/dist/extensions/pi-subagents/src/runs/background/retained-children.ts +1 -1
- package/dist/extensions/pi-subagents/src/runs/background/run-status.ts +50 -13
- package/dist/extensions/pi-subagents/src/runs/background/scheduled-runs.ts +93 -8
- package/dist/extensions/pi-subagents/src/runs/background/stale-run-reconciler.ts +10 -4
- package/dist/extensions/pi-subagents/src/runs/background/steering.ts +4 -14
- package/dist/extensions/pi-subagents/src/runs/background/subagent-runner.ts +549 -377
- package/dist/extensions/pi-subagents/src/runs/background/subagent-wait.ts +58 -10
- package/dist/extensions/pi-subagents/src/runs/background/terminal-run-index.ts +1 -1
- package/dist/extensions/pi-subagents/src/runs/background/wait-completions.ts +26 -1
- package/dist/extensions/pi-subagents/src/runs/background/wait-config.ts +23 -9
- package/dist/extensions/pi-subagents/src/runs/background/wait-tool.ts +9 -2
- package/dist/extensions/pi-subagents/src/runs/foreground/async-steering-action.ts +2 -2
- package/dist/extensions/pi-subagents/src/runs/foreground/execution.ts +204 -129
- package/dist/extensions/pi-subagents/src/runs/foreground/foreground-control.ts +9 -0
- package/dist/extensions/pi-subagents/src/runs/foreground/foreground-history.ts +23 -1
- package/dist/extensions/pi-subagents/src/runs/foreground/subagent-executor.ts +773 -311
- package/dist/extensions/pi-subagents/src/runs/foreground/workflow-detach-reconcile.ts +140 -115
- package/dist/extensions/pi-subagents/src/runs/shared/abort-recovery.ts +119 -0
- package/dist/extensions/pi-subagents/src/runs/shared/async-status-projection.ts +463 -0
- package/dist/extensions/pi-subagents/src/runs/shared/child-identity.ts +19 -4
- package/dist/extensions/pi-subagents/src/runs/shared/child-launch-plan.ts +151 -0
- package/dist/extensions/pi-subagents/src/runs/shared/child-protocol.ts +21 -7
- package/dist/extensions/pi-subagents/src/runs/shared/claude-code-adapter.ts +129 -0
- package/dist/extensions/pi-subagents/src/runs/shared/codex-exec-adapter.ts +129 -0
- package/dist/extensions/pi-subagents/src/runs/shared/completion-evidence.ts +89 -0
- package/dist/extensions/pi-subagents/src/runs/shared/completion-guard.ts +5 -4
- package/dist/extensions/pi-subagents/src/runs/shared/cursor-agent-adapter.ts +114 -0
- package/dist/extensions/pi-subagents/src/runs/shared/dynamic-fanout.ts +3 -3
- package/dist/extensions/pi-subagents/src/runs/shared/external-cli-contract.ts +167 -0
- package/dist/extensions/pi-subagents/src/runs/shared/external-cli-preflight.ts +122 -0
- package/dist/extensions/pi-subagents/src/runs/shared/external-cli-runner.ts +348 -55
- package/dist/extensions/pi-subagents/src/runs/shared/fast-mode-extension.ts +5 -5
- package/dist/extensions/pi-subagents/src/runs/shared/host-step-status.ts +230 -0
- package/dist/extensions/pi-subagents/src/runs/shared/lane-metadata.ts +105 -0
- package/dist/extensions/pi-subagents/src/runs/shared/launch-cwd.ts +16 -0
- package/dist/extensions/pi-subagents/src/runs/shared/long-running-guard.ts +2 -1
- package/dist/extensions/pi-subagents/src/runs/shared/mcp-config-sources.ts +422 -0
- package/dist/extensions/pi-subagents/src/runs/shared/mcp-direct-tool-allowlist.ts +221 -158
- package/dist/extensions/pi-subagents/src/runs/shared/mcp-direct-tool-grant.ts +197 -0
- package/dist/extensions/pi-subagents/src/runs/shared/model-exclusions.ts +69 -7
- package/dist/extensions/pi-subagents/src/runs/shared/model-fallback.ts +47 -6
- package/dist/extensions/pi-subagents/src/runs/shared/mutation-evidence.ts +7 -2
- package/dist/extensions/pi-subagents/src/runs/shared/nested-events.ts +9 -3
- package/dist/extensions/pi-subagents/src/runs/shared/nested-render.ts +9 -5
- package/dist/extensions/pi-subagents/src/runs/shared/parallel-handoff.ts +419 -7
- package/dist/extensions/pi-subagents/src/runs/shared/parallel-utils.ts +15 -1
- package/dist/extensions/pi-subagents/src/runs/shared/pi-args.ts +81 -8
- package/dist/extensions/pi-subagents/src/runs/shared/process-signal.ts +13 -0
- package/dist/extensions/pi-subagents/src/runs/shared/run-history.ts +21 -1
- package/dist/extensions/pi-subagents/src/runs/shared/single-output.ts +44 -4
- package/dist/extensions/pi-subagents/src/runs/shared/subagent-prompt-runtime.ts +98 -13
- package/dist/extensions/pi-subagents/src/runs/shared/subagent-startup-retry.ts +1 -1
- package/dist/extensions/pi-subagents/src/runs/shared/worktree-cleanup-plan.ts +847 -0
- package/dist/extensions/pi-subagents/src/runs/shared/worktree.ts +18 -0
- package/dist/extensions/pi-subagents/src/shared/child-session-name.ts +46 -0
- package/dist/extensions/pi-subagents/src/shared/extension-context.ts +24 -0
- package/dist/extensions/pi-subagents/src/shared/fork-context.ts +21 -0
- package/dist/extensions/pi-subagents/src/shared/formatters.ts +18 -3
- package/dist/extensions/pi-subagents/src/shared/launch-contract.ts +5 -1
- package/dist/extensions/pi-subagents/src/shared/pruned-fork.ts +450 -0
- package/dist/extensions/pi-subagents/src/shared/session-file-trust.ts +19 -0
- package/dist/extensions/pi-subagents/src/shared/session-tokens.ts +14 -3
- package/dist/extensions/pi-subagents/src/shared/settings.ts +19 -105
- package/dist/extensions/pi-subagents/src/shared/shortcuts.ts +17 -0
- package/dist/extensions/pi-subagents/src/shared/types.ts +359 -40
- package/dist/extensions/pi-subagents/src/shared/utils.ts +41 -84
- package/dist/extensions/pi-subagents/src/shared/workflow-child-permit.ts +116 -0
- package/dist/extensions/pi-subagents/src/slash/delegation-adapters.ts +1 -9
- package/dist/extensions/pi-subagents/src/slash/delegation-request.ts +0 -4
- package/dist/extensions/pi-subagents/src/slash/slash-bridge.ts +1 -2
- package/dist/extensions/pi-subagents/src/slash/slash-commands.ts +378 -88
- package/dist/extensions/pi-subagents/src/slash/slash-live-state.ts +22 -11
- package/dist/extensions/pi-subagents/src/slash/subagents-admin.ts +3 -0
- package/dist/extensions/pi-subagents/src/tui/fleet-status.ts +147 -79
- package/dist/extensions/pi-subagents/src/tui/fleet-transcript.ts +11 -5
- package/dist/extensions/pi-subagents/src/tui/fleet.ts +39 -18
- package/dist/extensions/pi-subagents/src/tui/render.ts +369 -46
- package/dist/extensions/pi-subagents/src/watchdog/turn-delta.ts +1 -1
- package/dist/extensions/pi-subagents/src/workflows/chat-progress.ts +6 -3
- package/dist/extensions/pi-subagents/src/workflows/host-command.ts +230 -0
- package/dist/extensions/pi-subagents/src/workflows/scripted-workflow.ts +740 -58
- package/dist/extensions/pi-subagents/src/workflows/workflow-child-summary.ts +121 -0
- package/dist/extensions/pi-subagents/src/workflows/workflow-preflight.ts +270 -0
- package/dist/extensions/pi-subagents/src/workflows/workflow-receipt.ts +195 -6
- package/dist/extensions/pi-subagents/src/workflows/workflow-settlement.ts +246 -0
- package/dist/extensions/pi-subagents/test/e2e/real-session-subagent.test.ts +2 -2
- package/dist/extensions/pi-subagents/test/integration/async-execution.test.ts +1114 -260
- package/dist/extensions/pi-subagents/test/integration/async-job-tracker.test.ts +34 -0
- package/dist/extensions/pi-subagents/test/integration/async-status.test.ts +150 -3
- package/dist/extensions/pi-subagents/test/integration/claude-code-smoke.test.ts +52 -0
- package/dist/extensions/pi-subagents/test/integration/claude-code-writer-smoke.test.ts +55 -0
- package/dist/extensions/pi-subagents/test/integration/codex-exec-smoke.test.ts +53 -0
- package/dist/extensions/pi-subagents/test/integration/codex-exec-writer-smoke.test.ts +57 -0
- package/dist/extensions/pi-subagents/test/integration/cursor-agent-smoke.test.ts +59 -0
- package/dist/extensions/pi-subagents/test/integration/cursor-agent-writer-smoke.test.ts +62 -0
- package/dist/extensions/pi-subagents/test/integration/error-handling.test.ts +57 -1
- package/dist/extensions/pi-subagents/test/integration/external-cli-runner.test.ts +1 -0
- package/dist/extensions/pi-subagents/test/integration/fork-context-execution.test.ts +20 -0
- package/dist/extensions/pi-subagents/test/integration/intercom-result-delivery.test.ts +4 -3
- package/dist/extensions/pi-subagents/test/integration/orca-progress-tabs.test.ts +2 -2
- package/dist/extensions/pi-subagents/test/integration/render-fork-badge.test.ts +54 -4
- package/dist/extensions/pi-subagents/test/integration/render-widget.test.ts +482 -4
- package/dist/extensions/pi-subagents/test/integration/result-watcher.test.ts +157 -9
- package/dist/extensions/pi-subagents/test/integration/session-tokens.test.ts +5 -5
- package/dist/extensions/pi-subagents/test/integration/single-execution.test.ts +1508 -291
- package/dist/extensions/pi-subagents/test/integration/slash-commands.test.ts +423 -1
- package/dist/extensions/pi-subagents/test/integration/template-resolution.test.ts +8 -0
- package/dist/extensions/pi-subagents/test/support/cursor-smoke-inputs.ts +51 -0
- package/dist/extensions/pi-subagents/test/support/helpers.ts +2 -0
- package/dist/extensions/pi-subagents/test/support/mock-pi.ts +5 -5
- package/dist/extensions/pi-subagents/test/support/real-session-runner.ts +6 -6
- package/dist/extensions/pi-subagents/test/unit/abort-recovery.test.ts +152 -0
- package/dist/extensions/pi-subagents/test/unit/active-async-capacity.test.ts +48 -0
- package/dist/extensions/pi-subagents/test/unit/agent-frontmatter.test.ts +184 -6
- package/dist/extensions/pi-subagents/test/unit/agent-management.test.ts +66 -6
- package/dist/extensions/pi-subagents/test/unit/agent-overrides.test.ts +77 -0
- package/dist/extensions/pi-subagents/test/unit/agent-refinements.test.ts +18 -0
- package/dist/extensions/pi-subagents/test/unit/anti-slop-oxlint.test.ts +86 -0
- package/dist/extensions/pi-subagents/test/unit/artifacts.test.ts +1 -1
- package/dist/extensions/pi-subagents/test/unit/async-execution.test.ts +101 -1
- package/dist/extensions/pi-subagents/test/unit/async-interrupt-action.test.ts +121 -0
- package/dist/extensions/pi-subagents/test/unit/async-recovery-descriptor.test.ts +28 -0
- package/dist/extensions/pi-subagents/test/unit/async-resume.test.ts +14 -7
- package/dist/extensions/pi-subagents/test/unit/async-retention.test.ts +53 -0
- package/dist/extensions/pi-subagents/test/unit/async-status-projection.test.ts +190 -0
- package/dist/extensions/pi-subagents/test/unit/async-status-snapshot.test.ts +42 -0
- package/dist/extensions/pi-subagents/test/unit/auto-drain.test.ts +8 -4
- package/dist/extensions/pi-subagents/test/unit/background-work.test.ts +23 -0
- package/dist/extensions/pi-subagents/test/unit/chain-root-attachment.test.ts +78 -1
- package/dist/extensions/pi-subagents/test/unit/child-launch-plan.test.ts +94 -0
- package/dist/extensions/pi-subagents/test/unit/child-protocol.test.ts +21 -0
- package/dist/extensions/pi-subagents/test/unit/child-session-name.test.ts +50 -0
- package/dist/extensions/pi-subagents/test/unit/claude-code-adapter.test.ts +245 -0
- package/dist/extensions/pi-subagents/test/unit/codex-exec-adapter.test.ts +192 -0
- package/dist/extensions/pi-subagents/test/unit/compaction-resume.test.ts +27 -0
- package/dist/extensions/pi-subagents/test/unit/completion-evidence.test.ts +150 -0
- package/dist/extensions/pi-subagents/test/unit/completion-guard.test.ts +21 -0
- package/dist/extensions/pi-subagents/test/unit/cursor-agent-adapter.test.ts +259 -0
- package/dist/extensions/pi-subagents/test/unit/cursor-smoke-inputs.test.ts +77 -0
- package/dist/extensions/pi-subagents/test/unit/delegation-api.test.ts +1 -4
- package/dist/extensions/pi-subagents/test/unit/doctor.test.ts +1 -1
- package/dist/extensions/pi-subagents/test/unit/extension-context.test.ts +27 -0
- package/dist/extensions/pi-subagents/test/unit/external-cli-runner.test.ts +223 -0
- package/dist/extensions/pi-subagents/test/unit/fast-mode-extension.test.ts +27 -0
- package/dist/extensions/pi-subagents/test/unit/fleet-status.test.ts +208 -2
- package/dist/extensions/pi-subagents/test/unit/fleet-transcript.test.ts +29 -1
- package/dist/extensions/pi-subagents/test/unit/fleet.test.ts +110 -1
- package/dist/extensions/pi-subagents/test/unit/foreground-control.test.ts +10 -0
- package/dist/extensions/pi-subagents/test/unit/formatters.test.ts +14 -0
- package/dist/extensions/pi-subagents/test/unit/herdr-inspector.test.ts +18 -9
- package/dist/extensions/pi-subagents/test/unit/herdr-session-roots-codec.test.ts +63 -0
- package/dist/extensions/pi-subagents/test/unit/herdr-shell-command.test.ts +2 -2
- package/dist/extensions/pi-subagents/test/unit/herdr-status-bridge.test.ts +136 -6
- package/dist/extensions/pi-subagents/test/unit/host-command.test.ts +156 -0
- package/dist/extensions/pi-subagents/test/unit/host-step-status.test.ts +98 -0
- package/dist/extensions/pi-subagents/test/unit/index-child-registration.test.ts +178 -26
- package/dist/extensions/pi-subagents/test/unit/index-segment.test.ts +2 -1
- package/dist/extensions/pi-subagents/test/unit/inspect-rpc.test.ts +21 -0
- package/dist/extensions/pi-subagents/test/unit/mcp-direct-tool-grant.test.ts +138 -0
- package/dist/extensions/pi-subagents/test/unit/mission-lifecycle.test.ts +1 -1
- package/dist/extensions/pi-subagents/test/unit/model-exclusions.test.ts +91 -0
- package/dist/extensions/pi-subagents/test/unit/model-fallback.test.ts +72 -7
- package/dist/extensions/pi-subagents/test/unit/mutation-evidence.test.ts +21 -0
- package/dist/extensions/pi-subagents/test/unit/nested-control.test.ts +1 -0
- package/dist/extensions/pi-subagents/test/unit/nested-events.test.ts +20 -2
- package/dist/extensions/pi-subagents/test/unit/notify.test.ts +129 -1
- package/dist/extensions/pi-subagents/test/unit/orca-progress-tabs.test.ts +2 -2
- package/dist/extensions/pi-subagents/test/unit/package-manifest.test.ts +4 -0
- package/dist/extensions/pi-subagents/test/unit/parallel-handoff.test.ts +358 -0
- package/dist/extensions/pi-subagents/test/unit/pi-args.test.ts +574 -21
- package/dist/extensions/pi-subagents/test/unit/pi-coding-agent-dir.test.ts +109 -1
- package/dist/extensions/pi-subagents/test/unit/preflight.test.ts +71 -1
- package/dist/extensions/pi-subagents/test/unit/profiles.test.ts +7 -7
- package/dist/extensions/pi-subagents/test/unit/pruned-fork.test.ts +214 -0
- package/dist/extensions/pi-subagents/test/unit/public-execution.test.ts +29 -8
- package/dist/extensions/pi-subagents/test/unit/render-helpers.test.ts +53 -0
- package/dist/extensions/pi-subagents/test/unit/result-delivery-ownership.test.ts +34 -0
- package/dist/extensions/pi-subagents/test/unit/result-files.test.ts +101 -3
- package/dist/extensions/pi-subagents/test/unit/retained-children.test.ts +1 -0
- package/dist/extensions/pi-subagents/test/unit/rpc.test.ts +10 -8
- package/dist/extensions/pi-subagents/test/unit/run-fanout-budget.test.ts +71 -1
- package/dist/extensions/pi-subagents/test/unit/run-status.test.ts +41 -7
- package/dist/extensions/pi-subagents/test/unit/runtime-agent-registration.test.ts +136 -2
- package/dist/extensions/pi-subagents/test/unit/scheduled-runs.test.ts +137 -0
- package/dist/extensions/pi-subagents/test/unit/schemas.test.ts +33 -12
- package/dist/extensions/pi-subagents/test/unit/scripted-workflow.test.ts +504 -1
- package/dist/extensions/pi-subagents/test/unit/single-output.test.ts +8 -0
- package/dist/extensions/pi-subagents/test/unit/skills-fallback.test.ts +1 -1
- package/dist/extensions/pi-subagents/test/unit/stale-run-reconciler.test.ts +12 -1
- package/dist/extensions/pi-subagents/test/unit/steering-action.test.ts +3 -5
- package/dist/extensions/pi-subagents/test/unit/steering.test.ts +5 -6
- package/dist/extensions/pi-subagents/test/unit/subagent-action-recovery.test.ts +0 -8
- package/dist/extensions/pi-subagents/test/unit/subagent-guide.test.ts +5 -0
- package/dist/extensions/pi-subagents/test/unit/subagent-prompt-runtime.test.ts +157 -2
- package/dist/extensions/pi-subagents/test/unit/subagent-startup-retry.test.ts +1 -1
- package/dist/extensions/pi-subagents/test/unit/subagent-wait.test.ts +63 -4
- package/dist/extensions/pi-subagents/test/unit/tool-description.test.ts +27 -23
- package/dist/extensions/pi-subagents/test/unit/wait-completions.test.ts +44 -0
- package/dist/extensions/pi-subagents/test/unit/wait-subscriptions.test.ts +1 -0
- package/dist/extensions/pi-subagents/test/unit/widget-nested-render.test.ts +7 -5
- package/dist/extensions/pi-subagents/test/unit/workflow-chat-progress.test.ts +106 -0
- package/dist/extensions/pi-subagents/test/unit/workflow-detach-reconcile.test.ts +484 -9
- package/dist/extensions/pi-subagents/test/unit/workflow-launch-params.test.ts +38 -4
- package/dist/extensions/pi-subagents/test/unit/workflow-preflight.test.ts +155 -0
- package/dist/extensions/pi-subagents/test/unit/workflow-receipt.test.ts +318 -0
- package/dist/extensions/pi-subagents/test/unit/workflow-resume-hint.test.ts +365 -0
- package/dist/extensions/pi-subagents/test/unit/worktree-cleanup-plan.test.ts +349 -0
- package/dist/extensions/pi-subagents/test/unit/worktree.test.ts +21 -0
- package/dist/extensions/pi-subagents/test/unit/writer-budget-guidance.test.ts +2 -7
- package/dist/extensions/pi-subagents/tools/oxlint/anti-slop/effect/index.ts +13 -0
- package/dist/extensions/pi-subagents/tools/oxlint/anti-slop/effect/rules/no-service-constructor-imports.ts +52 -0
- package/dist/extensions/pi-subagents/tools/oxlint/anti-slop/index.ts +41 -0
- package/dist/extensions/pi-subagents/tools/oxlint/anti-slop/rules/no-chained-type-assertions.ts +77 -0
- package/dist/extensions/pi-subagents/tools/oxlint/anti-slop/rules/no-conditional-empty-object-spread.ts +49 -0
- package/dist/extensions/pi-subagents/tools/oxlint/anti-slop/rules/no-known-value-widening.ts +247 -0
- package/dist/extensions/pi-subagents/tools/oxlint/anti-slop/rules/no-module-mocking.ts +91 -0
- package/dist/extensions/pi-subagents/tools/oxlint/anti-slop/rules/no-object-parameters.ts +126 -0
- package/dist/extensions/pi-subagents/tools/oxlint/anti-slop/rules/no-reflect-apply.ts +28 -0
- package/dist/extensions/pi-subagents/tools/oxlint/anti-slop/rules/no-reflect-get.ts +28 -0
- package/dist/extensions/pi-subagents/tools/oxlint/anti-slop/rules/no-runtime-typeof.ts +67 -0
- package/dist/extensions/pi-subagents/tools/oxlint/anti-slop/rules/no-shape-in-symbol-names.ts +39 -0
- package/dist/extensions/pi-subagents/tools/oxlint/anti-slop/rules/no-unknown-parameters.ts +83 -0
- package/dist/extensions/pi-subagents/tools/oxlint/anti-slop/rules/no-unknown-returns.ts +115 -0
- package/dist/extensions/pi-subagents/tools/oxlint/anti-slop/rules/no-unknown-type-aliases.ts +72 -0
- package/dist/extensions/pi-subagents/tools/oxlint/anti-slop/rules/no-unsafe-dictionary-type.ts +134 -0
- package/dist/extensions/pi-subagents/tools/oxlint/anti-slop/rules/no-widen-then-assert.ts +366 -0
- package/dist/extensions/pi-subagents/tools/oxlint/anti-slop/rules/require-safety-comment-for-type-assertion.ts +62 -0
- package/dist/extensions/pi-subagents/tools/oxlint/anti-slop/shared/dictionary-types.ts +502 -0
- package/dist/extensions/pi-subagents/tools/oxlint/anti-slop/shared/lexical-type-parameters.ts +60 -0
- package/dist/extensions/pi-subagents/tools/oxlint/anti-slop/shared/reflect-method.ts +35 -0
- package/dist/extensions/pi-tool-display/tests/capabilities.test.ts +1 -1
- package/dist/extensions/pi-tool-display/tests/settings-inspector.test.ts +2 -2
- package/dist/extensions/pi-tool-display/tests/tool-overrides-mcp.test.ts +1 -1
- package/dist/modes/interactive/interactive-mode.js +7 -7
- package/dist/skills/workflow/SKILL.md +65 -50
- package/package.json +112 -110
- package/dist/extensions/enable-readonly-tools.test.ts +0 -63
- package/dist/extensions/enable-readonly-tools.ts +0 -24
- package/dist/extensions/model-prompt-injector/config.json +0 -16
- package/dist/extensions/model-prompt-injector/index.test.ts +0 -102
- package/dist/extensions/model-prompt-injector/index.ts +0 -148
- package/dist/extensions/pi-subagents/src/runs/shared/turn-budget.ts +0 -98
- package/dist/extensions/pi-subagents/test/unit/turn-budget.test.ts +0 -250
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
# Tasks — Pi Hermes Memory Extension
|
|
2
|
+
|
|
3
|
+
> **Workflow**: When you start a task, change `[ ]` to `[~]`. When done, change to `[x]` and note the commit hash.
|
|
4
|
+
> Progress is tracked per-epic. Each epic has a clear definition of done.
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Epic 1: Project Scaffold & Repo Setup
|
|
9
|
+
|
|
10
|
+
_Done when: repo is on GitHub, TypeScript compiles clean, extension loads in Pi without errors._
|
|
11
|
+
|
|
12
|
+
- [x] `PLAN.md` — Full implementation plan with Hermes source file reference map — `efddcc4`
|
|
13
|
+
- [x] `AGENTS.md` — Project context and architecture docs — `efddcc4`
|
|
14
|
+
- [x] `.gitignore` — Exclude node_modules, dist, .codegraph, hermes-agent — `efddcc4`
|
|
15
|
+
- [x] `package.json` — Minimal config, no runtime deps — `efddcc4`
|
|
16
|
+
- [x] `tsconfig.json` — Strict TypeScript config — `efddcc4`
|
|
17
|
+
- [x] `src/types.ts` — Shared interfaces (`MemoryConfig`, `MemoryResult`, `MemorySnapshot`) + `getMessageText()` helper — `efddcc4`
|
|
18
|
+
- [x] `src/constants.ts` — Prompts, defaults, delimiter — `efddcc4`
|
|
19
|
+
- [x] `src/store/content-scanner.ts` — Injection/exfiltration pattern detection — `efddcc4`
|
|
20
|
+
- [x] `src/store/memory-store.ts` — Core `MemoryStore` class with CRUD, atomic writes, frozen snapshot — `efddcc4`
|
|
21
|
+
- [x] `src/tools/memory-tool.ts` — `registerMemoryTool()` with Pi tool API — `efddcc4`
|
|
22
|
+
- [x] `src/handlers/background-review.ts` — Learning loop via `pi.exec()` — `efddcc4`
|
|
23
|
+
- [x] `src/handlers/session-flush.ts` — Pre-compaction/shutdown flush — `efddcc4`
|
|
24
|
+
- [x] `src/handlers/insights.ts` — `/memory-insights` command — `efddcc4`
|
|
25
|
+
- [x] `src/index.ts` — Extension entry point wiring everything — `efddcc4`
|
|
26
|
+
- [x] GitHub repo created and initial commit pushed — `efddcc4`
|
|
27
|
+
- [x] `npm install` + `npm run check` passes with zero errors
|
|
28
|
+
- [x] Extension loads in Pi via `pi -e ./src/index.ts` without runtime errors — verified
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Epic 2: Core Memory — Store & Tool
|
|
33
|
+
|
|
34
|
+
_Done when: agent can add/replace/remove entries, they persist to disk, and survive a Pi session restart._
|
|
35
|
+
|
|
36
|
+
- [x] `MemoryStore.loadFromDisk()` correctly reads existing MEMORY.md and USER.md — `24151a0`
|
|
37
|
+
- [x] `MemoryStore.add()` validates content, enforces char limit, persists atomically — `24151a0`
|
|
38
|
+
- [x] `MemoryStore.replace()` finds entry by substring, replaces, re-checks limit — `24151a0`
|
|
39
|
+
- [x] `MemoryStore.remove()` finds entry by substring, removes, persists — `24151a0`
|
|
40
|
+
- [x] `MemoryStore.formatForSystemPrompt()` returns frozen snapshot (not live state) — `24151a0`
|
|
41
|
+
- [x] Atomic write works: temp file → `fs.rename()` (verify no corruption on crash simulation) — `24151a0`
|
|
42
|
+
- [x] Character limits enforced: reject writes that exceed `memoryCharLimit` / `userCharLimit` — `24151a0`
|
|
43
|
+
- [x] Deduplication: adding an identical entry is a no-op — `24151a0`
|
|
44
|
+
- [x] Multi-match ambiguity: replace/remove error when multiple distinct entries match — `24151a0`
|
|
45
|
+
- [x] `memory` tool registered with correct name, parameters, and guidelines — `tests/tools/memory-tool.test.ts`
|
|
46
|
+
- [x] Tool execute returns JSON with `usage` field showing char budget — `tests/tools/memory-tool.test.ts`
|
|
47
|
+
- [x] LLM can call (manual verification — no API key configured) `memory` tool with `add` action and entry appears in MEMORY.md — **manual verification required**
|
|
48
|
+
- [x] LLM can call (manual verification — no API key configured) `memory` tool with `target: "user"` and entry appears in USER.md — **manual verification required**
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## Epic 3: Content Scanning & Security
|
|
53
|
+
|
|
54
|
+
_Done when: all injection/exfiltration patterns are blocked, invisible unicode is blocked, and safe content passes through._
|
|
55
|
+
|
|
56
|
+
- [x] `scanContent()` blocks prompt injection patterns (e.g. "ignore previous instructions") — `3f61b61`
|
|
57
|
+
- [x] `scanContent()` blocks role hijacking (e.g. "you are now...") — `3f61b61`
|
|
58
|
+
- [x] `scanContent()` blocks secret exfiltration (e.g. `curl ${API_KEY...`) — `3f61b61`
|
|
59
|
+
- [x] `scanContent()` blocks invisible unicode (U+200B, U+FEFF, U+202A-U+202E) — `3f61b61`
|
|
60
|
+
- [x] `scanContent()` returns `null` for safe/normal content — `3f61b61`
|
|
61
|
+
- [x] Blocked writes return `{ success: false, error: "Blocked: ..." }` to the LLM — `3f61b61`
|
|
62
|
+
- [x] Edge case: empty string passes (handled by empty check before scanner) — `3f61b61`
|
|
63
|
+
- [x] Edge case: very long content with pattern at end is still caught — `3f61b61`
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## Epic 4: System Prompt Injection
|
|
68
|
+
|
|
69
|
+
_Done when: memory snapshot appears in system prompt at session start and does NOT update mid-session._
|
|
70
|
+
|
|
71
|
+
- [x] `before_agent_start` handler appends memory block to `event.systemPrompt` — `028c5ad`
|
|
72
|
+
- [x] Memory block includes header with usage percentage and char count — `028c5ad`
|
|
73
|
+
- [x] Block format matches Hermes: `═` separator, header line, then content — `028c5ad`
|
|
74
|
+
- [x] Frozen snapshot: write to memory mid-session → system prompt unchanged — `028c5ad`
|
|
75
|
+
- [x] Empty memory files → no block appended (system prompt untouched) — `028c5ad`
|
|
76
|
+
- [x] Second session (manual verification — needs Pi restart): memory saved in session 1 appears in session 2's system prompt
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## Epic 5: Background Learning Loop
|
|
80
|
+
|
|
81
|
+
_Done when: after N turns, a background pi process reviews the conversation and saves notable facts automatically._
|
|
82
|
+
|
|
83
|
+
- [x] Turn counter increments on each `turn_end` event — `164eef9`
|
|
84
|
+
- [x] User turn counter increments only on user messages (not assistant/tool) — `164eef9`
|
|
85
|
+
- [x] Review triggers at `nudgeInterval` (default 10) turns — `164eef9`
|
|
86
|
+
- [x] Review does NOT trigger if `reviewEnabled` is false — `164eef9`
|
|
87
|
+
- [x] Review does NOT trigger if fewer than 3 user turns — `164eef9`
|
|
88
|
+
- [x] Review does NOT trigger if already in progress (`reviewInProgress` guard) — `164eef9`
|
|
89
|
+
- [x] `pi.exec("pi", ["-p", "--no-session", ...])` is called with correct review prompt — `164eef9`
|
|
90
|
+
- [x] Review prompt includes current memory + user profile + conversation snapshot — `164eef9`
|
|
91
|
+
- [x] Successful auto-save shows `💾 Memory auto-reviewed and updated` notification — `164eef9`
|
|
92
|
+
- [x] "Nothing to save" response → no notification shown — `164eef9`
|
|
93
|
+
- [x] Background review failure does NOT crash or block the main agent — `164eef9`
|
|
94
|
+
- [x] Counter resets to 0 after review triggers — `164eef9`
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
## Epic 6: Session Flush
|
|
98
|
+
|
|
99
|
+
_Done when: before compaction and session shutdown, agent gets one turn to save memories._
|
|
100
|
+
|
|
101
|
+
- [x] `session_before_compact` event triggers flush when `flushOnCompact` is true — `001a8d4`
|
|
102
|
+
- [x] `session_shutdown` event triggers flush when `flushOnShutdown` is true — `001a8d4`
|
|
103
|
+
- [x] Flush skips if user turn count < `flushMinTurns` (default 6) — `001a8d4`
|
|
104
|
+
- [x] Flush builds conversation snapshot from `ctx.sessionManager.getBranch()` — `001a8d4`
|
|
105
|
+
- [x] Flush uses `pi.exec("pi", ["-p", "--no-session", ...])` with flush prompt — `001a8d4`
|
|
106
|
+
- [x] Flush failure does NOT prevent compaction or session shutdown — `001a8d4`
|
|
107
|
+
- [x] After flush (manual verification — needs Pi restart), any saved memories are available in next session
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
## Epic 7: Insights Command & UX Polish
|
|
111
|
+
|
|
112
|
+
_Done when: `/memory-insights` shows formatted output and the extension is polished for users._
|
|
113
|
+
|
|
114
|
+
- [x] `/memory-insights` command registered and appears in Pi command list — `543e262`
|
|
115
|
+
- [x] Shows MEMORY section with numbered entries (truncated to 100 chars) — `543e262`
|
|
116
|
+
- [x] Shows USER PROFILE section with numbered entries — `543e262`
|
|
117
|
+
- [x] Shows "(empty)" when no entries exist — `543e262`
|
|
118
|
+
- [x] Formatted with box drawing characters (╔══╗, etc.) — `543e262`
|
|
119
|
+
- [x] Notification displays (manual verification — needs Pi TUI) correctly in Pi's TUI
|
|
120
|
+
---
|
|
121
|
+
|
|
122
|
+
## Epic 8: Configuration & Settings
|
|
123
|
+
|
|
124
|
+
_Done when: users can customize behavior via `~/.selesai/agent/hermes-memory-config.json`._
|
|
125
|
+
- [x] Read config from `~/.selesai/agent/hermes-memory-config.json` — `src/config.ts`
|
|
126
|
+
- [x] All `MemoryConfig` fields are configurable with type validation
|
|
127
|
+
- [x] Missing keys fall back to defaults
|
|
128
|
+
- [x] Documented in README.md
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## Epic 9: Testing
|
|
133
|
+
|
|
134
|
+
_Done when: all core paths have automated tests and the extension passes a manual smoke test._
|
|
135
|
+
|
|
136
|
+
### Unit Tests
|
|
137
|
+
- [x] `content-scanner.ts` — 11 threat patterns + 5 invisible unicode chars tested — `3f61b61`
|
|
138
|
+
- [x] `memory-store.ts` — test `add` success, persistence, duplicate → no-op, exceeds limit → error — `24151a0`
|
|
139
|
+
- [x] `memory-store.ts` — test `replace` success, no match → error, multi-match → error — `24151a0`
|
|
140
|
+
- [x] `memory-store.ts` — test `remove` success, no match → error — `24151a0`
|
|
141
|
+
- [x] `memory-store.ts` — test frozen snapshot doesn't update after add — `24151a0`
|
|
142
|
+
- [x] `memory-store.ts` — test `loadFromDisk` reads existing files, handles missing files — `24151a0`
|
|
143
|
+
- [x] `config.ts` — test defaults, overrides, partial config, invalid values — current
|
|
144
|
+
- [x] `handlers/` — test background-review, session-flush, insights, system-prompt — current
|
|
145
|
+
- [x] `integration/` — test cross-module contracts (config→store, security pipeline, getMessageText) — current
|
|
146
|
+
|
|
147
|
+
### Integration Tests
|
|
148
|
+
- [x] Extension loads in Pi via `pi -e ./src/index.ts` — no errors — verified
|
|
149
|
+
- [x] `memory` tool callable by LLM (manual verification — no API key) — manual verification required
|
|
150
|
+
- [x] System prompt contains (manual verification — needs Pi runtime) memory block after `session_start` — manual verification required
|
|
151
|
+
- [x] `/memory-insights` (manual verification — needs Pi runtime) command runs and shows output — manual verification required
|
|
152
|
+
- [x] Survives Pi session (manual verification — needs Pi restart) restart — memory persists across `/new` — manual verification required
|
|
153
|
+
|
|
154
|
+
### Manual Smoke Tests
|
|
155
|
+
- [x] Full E2E (manual verification — needs full conversation): install → use 10+ turns → verify auto-review saves memory
|
|
156
|
+
- [x] Full E2E (manual verification — needs full conversation): long conversation → trigger compaction → verify flush saves memory
|
|
157
|
+
- [x] Full E2E (manual verification — needs full conversation): session 1 saves memory → quit → session 2 recalls it
|
|
158
|
+
- [x] Security: try injecting (manual verification — needs Pi runtime) "ignore previous instructions" → verify blocked
|
|
159
|
+
- [x] Security: try saving (manual verification — needs Pi runtime) `curl ${API_KEY}` → verify blocked
|
|
160
|
+
|
|
161
|
+
---
|
|
162
|
+
|
|
163
|
+
## Epic 10: Documentation & Distribution
|
|
164
|
+
|
|
165
|
+
_Done when: extension is installable via `pi install` and has user-facing docs._
|
|
166
|
+
|
|
167
|
+
- [x] `README.md` — What it does, installation, usage, configuration — `ed22fa6`
|
|
168
|
+
- [x] `README.md` — Example screenshots (manual verification — needs Pi TUI) of `/memory-insights` output — requires Pi TUI
|
|
169
|
+
- [x] Verify `pi install github:chandra447/pi-hermes-memory` works end-to-end — requires Pi CLI
|
|
170
|
+
- [x] Tag v0.1.0 release on GitHub — `7983f09`
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
## Summary
|
|
175
|
+
|
|
176
|
+
| Epic | Status | Notes |
|
|
177
|
+
|---|---|---|
|
|
178
|
+
| 1 — Project Scaffold | Complete | TypeScript compiles clean, extension loads in Pi |
|
|
179
|
+
| 2 — Core Memory | Complete (auto) / 2 pending (manual) | Tool registration + execute tested; LLM interaction needs Pi runtime |
|
|
180
|
+
| 3 — Content Scanning | Complete | 25 tests, all threat patterns covered |
|
|
181
|
+
| 4 — System Prompt | Complete (auto) / 1 pending (manual) | Frozen snapshot tested; cross-session needs Pi restart |
|
|
182
|
+
| 5 — Background Loop | Complete | 10 tests, all trigger conditions covered |
|
|
183
|
+
| 6 — Session Flush | Complete (auto) / 1 pending (manual) | Flush logic tested; cross-session persistence needs Pi restart |
|
|
184
|
+
| 7 — Insights | Complete (auto) / 1 pending (manual) | Command output tested; TUI display needs Pi runtime |
|
|
185
|
+
| 8 — Configuration | Complete | Config file + tests + README docs |
|
|
186
|
+
| 9 — Testing | Complete (auto) / 9 pending (manual) | 119 automated tests; E2E smoke tests need Pi runtime |
|
|
187
|
+
| 10 — Documentation | Complete (auto) / 2 pending (manual) | README + LICENSE + tag v0.1.0; screenshots need Pi TUI |
|
|
188
|
+
|
|
189
|
+
**Automated test coverage: 119 tests, 0 failures, 0 type errors.**
|
|
190
|
+
|
|
191
|
+
**Manual verification required:** Run `pi -e ./src/index.ts` or `pi install github:chandra447/pi-hermes-memory`, then:
|
|
192
|
+
1. Have the LLM save a memory and verify it appears in `~/.selesai/agent/memory/MEMORY.md`
|
|
193
|
+
2. Start a new session (`/new`) and verify the memory appears in the system prompt
|
|
194
|
+
3. Use 10+ turns and verify auto-review triggers
|
|
195
|
+
4. Trigger `/compact` and verify flush saves memories
|
|
196
|
+
5. Run `/memory-insights` and verify formatted output
|
|
197
|
+
6. Try injecting malicious content and verify it's blocked
|
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
# v0.2.0 Implementation Plan — Skills + Smart Curation
|
|
2
|
+
|
|
3
|
+
> **Goal**: Close the two biggest Hermes gaps — procedural memory (skills) and intelligent memory management (auto-consolidation, correction detection, tool-call-aware nudges).
|
|
4
|
+
|
|
5
|
+
## Implementation Order
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
Epic 2 (Auto-Consolidation) → standalone, modifies MemoryStore.add()
|
|
9
|
+
Epic 3 (Correction Detection) → standalone, new handler
|
|
10
|
+
Epic 4 (Tool-Call Nudge) → modifies background-review.ts
|
|
11
|
+
Epic 1 (Skill Tool) → largest: new store + tool + handlers
|
|
12
|
+
Epic 5 (Docs + Release) → depends on all above
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Epics 2, 3, 4 are independent but done sequentially to avoid merge conflicts in shared files (`types.ts`, `config.ts`, `constants.ts`, `index.ts`).
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Epic 2: Auto-Consolidation
|
|
20
|
+
|
|
21
|
+
**Problem**: When `add()` exceeds char limit, we return an error. Hermes auto-consolidates.
|
|
22
|
+
|
|
23
|
+
### New Files
|
|
24
|
+
|
|
25
|
+
**`src/handlers/auto-consolidate.ts`** (~120 lines)
|
|
26
|
+
```typescript
|
|
27
|
+
export async function triggerConsolidation(
|
|
28
|
+
pi: ExtensionAPI,
|
|
29
|
+
store: MemoryStore,
|
|
30
|
+
target: "memory" | "user",
|
|
31
|
+
signal?: AbortSignal,
|
|
32
|
+
): Promise<ConsolidationResult>
|
|
33
|
+
```
|
|
34
|
+
- Builds prompt from `CONSOLIDATION_PROMPT` + current entries for the target
|
|
35
|
+
- Calls `pi.exec("pi", ["-p", "--no-session", prompt], { signal, timeout: 60000 })`
|
|
36
|
+
- Returns `{ consolidated: true }` on success, `{ consolidated: false, error }` on failure
|
|
37
|
+
|
|
38
|
+
**`src/handlers/consolidate-command.ts`** (~30 lines)
|
|
39
|
+
- Registers `/memory-consolidate` via `pi.registerCommand()`
|
|
40
|
+
- Runs consolidation for both targets, reports via `ctx.ui.notify()`
|
|
41
|
+
|
|
42
|
+
**`tests/handlers/auto-consolidate.test.ts`** (~120 lines)
|
|
43
|
+
|
|
44
|
+
### Modified Files
|
|
45
|
+
|
|
46
|
+
**`src/constants.ts`** — Add `CONSOLIDATION_PROMPT`
|
|
47
|
+
|
|
48
|
+
**`src/types.ts`** — Add `autoConsolidate: boolean` to `MemoryConfig`; add `ConsolidationResult` interface
|
|
49
|
+
|
|
50
|
+
**`src/config.ts`** — Add `autoConsolidate: true` default + parsing
|
|
51
|
+
|
|
52
|
+
**`src/store/memory-store.ts`** — Key changes:
|
|
53
|
+
- `add()` becomes **async** (returns `Promise<MemoryResult>`)
|
|
54
|
+
- Add `setConsolidator()` method for dependency injection (avoids circular import)
|
|
55
|
+
- When over limit + consolidator set: call consolidator, **reload from disk** (`await this.loadFromDisk()`), then retry once
|
|
56
|
+
- **Critical**: The `pi.exec()` child process modifies files on disk. The parent's in-memory arrays become stale after consolidation. We MUST reload before retrying `add()` or the retry will overwrite consolidated entries with stale data.
|
|
57
|
+
|
|
58
|
+
**`src/tools/memory-tool.ts`** — `await store.add(target, content)` (line ~58)
|
|
59
|
+
|
|
60
|
+
**`src/index.ts`** — Wire consolidator + register command
|
|
61
|
+
|
|
62
|
+
**Test migration**: Making `add()` async means all existing tests calling `store.add()` must use `await`. Without `await`, tests get a Promise object instead of `MemoryResult`, causing assertion failures. Update all `store.add()` calls in `tests/store/memory-store.test.ts` to `await store.add()`.
|
|
63
|
+
|
|
64
|
+
### Key Decision: Consolidator Injection via Setter
|
|
65
|
+
MemoryStore cannot import from handlers (circular). Instead, `index.ts` injects a consolidator function via `store.setConsolidator()` after both `store` and `pi` are available.
|
|
66
|
+
|
|
67
|
+
### Key Decision: No memoryDirPath Getter
|
|
68
|
+
SkillStore receives its directory path directly from config (`config.memoryDir + "/skills/"`) in `index.ts`. No need to expose MemoryStore internals.
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## Epic 3: Correction Detection + Immediate Save
|
|
73
|
+
|
|
74
|
+
**Problem**: User says "no, don't do that" — we only save it 8 turns later at the next nudge. Hermes detects immediately.
|
|
75
|
+
|
|
76
|
+
### New Files
|
|
77
|
+
|
|
78
|
+
**`src/handlers/correction-detector.ts`** (~100 lines)
|
|
79
|
+
```typescript
|
|
80
|
+
export function setupCorrectionDetector(
|
|
81
|
+
pi: ExtensionAPI,
|
|
82
|
+
store: MemoryStore,
|
|
83
|
+
config: MemoryConfig,
|
|
84
|
+
): void
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
**Design**:
|
|
88
|
+
1. On `message_end` (role=user): check text against `CORRECTION_PATTERNS`, set `pendingCorrection = true`
|
|
89
|
+
2. On `turn_end`: if `pendingCorrection`, trigger `pi.exec()` with `CORRECTION_SAVE_PROMPT` + recent messages + current memory
|
|
90
|
+
3. Rate limit: `turnsSinceLastCorrection >= 3` and `!correctionInProgress`
|
|
91
|
+
|
|
92
|
+
**Why turn_end, not message_end**: We need the full context (user correction + what agent said wrong) for the save prompt.
|
|
93
|
+
|
|
94
|
+
**`tests/handlers/correction-detector.test.ts`** (~150 lines)
|
|
95
|
+
|
|
96
|
+
### Modified Files
|
|
97
|
+
|
|
98
|
+
**`src/constants.ts`** — Add `CORRECTION_SAVE_PROMPT` and `CORRECTION_PATTERNS` (regex array)
|
|
99
|
+
|
|
100
|
+
**`src/types.ts`** — Add `correctionDetection: boolean` to `MemoryConfig`
|
|
101
|
+
|
|
102
|
+
**`src/config.ts`** — Add `correctionDetection: true` default + parsing
|
|
103
|
+
|
|
104
|
+
**`src/index.ts`** — Wire `setupCorrectionDetector()`
|
|
105
|
+
|
|
106
|
+
### Correction Patterns (Two-Pass Filter)
|
|
107
|
+
|
|
108
|
+
Patterns are split into **strong** (high confidence, trigger immediately) and **weak** (need a directive clause to confirm).
|
|
109
|
+
|
|
110
|
+
**Strong patterns** (always trigger):
|
|
111
|
+
```typescript
|
|
112
|
+
/don'?t do that/i, /not like that/i,
|
|
113
|
+
/^I said\b/i, /^I told you\b/i, /we already discussed/i,
|
|
114
|
+
/^please don'?t/i, /^that'?s not what I/i
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
**Weak patterns** (only trigger if followed by a directive — verb or "the/that/this"):
|
|
118
|
+
```typescript
|
|
119
|
+
/^no[,.\s!]/i, /^wrong[,.\s!]/i, /^actually[,.\s]/i, /^stop[,.\s!]/i
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
**Negative patterns** (suppress trigger even if a positive pattern matches):
|
|
123
|
+
```typescript
|
|
124
|
+
/^no worries/i, /^no problem/i, /^no thanks/i, /^no need/i,
|
|
125
|
+
/^actually.{0,10}(looks? great|perfect|good|correct|right)/i,
|
|
126
|
+
/^stop.{0,5}(there|here|for now)/i
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
This eliminates false positives like "no worries, I'll handle it" and "actually, that looks great" while still catching "no, don't use npm" and "actually, use yarn instead".
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
## Epic 4: Tool-Call-Aware Nudge
|
|
134
|
+
|
|
135
|
+
**Problem**: Nudge is purely turn-count based. Complex tasks with many tool calls generate more valuable memories.
|
|
136
|
+
|
|
137
|
+
### Modified Files
|
|
138
|
+
|
|
139
|
+
**`src/types.ts`** — Add `nudgeToolCalls: number` to `MemoryConfig`
|
|
140
|
+
|
|
141
|
+
**`src/config.ts`** — Add `nudgeToolCalls: 15` default + parsing
|
|
142
|
+
|
|
143
|
+
**`src/handlers/background-review.ts`** — Key changes:
|
|
144
|
+
- Count tool-use entries from `ctx.sessionManager.getBranch()` at `turn_end` time (robust — no unknown event names)
|
|
145
|
+
- Change trigger to OR logic: `turnsSinceReview >= nudgeInterval || toolCallsSinceReview >= nudgeToolCalls`
|
|
146
|
+
- Reset both counters on review
|
|
147
|
+
|
|
148
|
+
**`tests/handlers/background-review.test.ts`** — Add tool-call trigger tests
|
|
149
|
+
|
|
150
|
+
### Key Decision: Count from Branch, Not Events
|
|
151
|
+
Rather than depending on unknown Pi event names like `tool_end`, count tool-use entries from `ctx.sessionManager.getBranch()` at `turn_end` time. More robust and testable.
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
## Epic 1: Skill Tool + Procedural Memory
|
|
156
|
+
|
|
157
|
+
**Problem**: `COMBINED_REVIEW_PROMPT` asks about skills but there's no skill tool. This is the single highest-leverage change.
|
|
158
|
+
|
|
159
|
+
### New Files
|
|
160
|
+
|
|
161
|
+
**`src/store/skill-store.ts`** (~250 lines)
|
|
162
|
+
```typescript
|
|
163
|
+
export class SkillStore {
|
|
164
|
+
constructor(private skillsDir: string) {}
|
|
165
|
+
async loadIndex(): Promise<SkillIndex[]>
|
|
166
|
+
async loadSkill(fileName: string): Promise<SkillDocument | null>
|
|
167
|
+
async create(name: string, description: string, body: string): Promise<SkillResult>
|
|
168
|
+
async patch(fileName: string, section: string, newContent: string): Promise<SkillResult>
|
|
169
|
+
async edit(fileName: string, description: string, body: string): Promise<SkillResult>
|
|
170
|
+
async delete(fileName: string): Promise<SkillResult>
|
|
171
|
+
formatIndexForSystemPrompt(): string
|
|
172
|
+
}
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
**Storage**: `~/.selesai/agent/memory/skills/` (isolated from user skills at `~/.selesai/agent/skills/`)
|
|
176
|
+
|
|
177
|
+
**SKILL.md format**:
|
|
178
|
+
```markdown
|
|
179
|
+
---
|
|
180
|
+
name: debug-typescript-errors
|
|
181
|
+
description: Step-by-step approach to debugging TS errors in monorepos
|
|
182
|
+
version: 1
|
|
183
|
+
created: 2026-04-27
|
|
184
|
+
updated: 2026-04-27
|
|
185
|
+
---
|
|
186
|
+
## When to Use
|
|
187
|
+
## Procedure
|
|
188
|
+
## Pitfalls
|
|
189
|
+
## Verification
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
**Frontmatter parsing**: Simple regex (no yaml dependency). Split on `---`, parse key-value pairs.
|
|
193
|
+
|
|
194
|
+
**File naming**: `slugify(name) + ".md"` — lowercase, replace non-alphanum with `-`, collapse dashes.
|
|
195
|
+
|
|
196
|
+
**`src/tools/skill-tool.ts`** (~180 lines)
|
|
197
|
+
- Registered via `pi.registerTool()` with actions: `create`, `view`, `patch`, `edit`, `delete`
|
|
198
|
+
- Content scanning on all writes via `scanContent()`
|
|
199
|
+
|
|
200
|
+
**`src/handlers/skill-auto-trigger.ts`** (~80 lines)
|
|
201
|
+
- Track tool calls per turn
|
|
202
|
+
- When turn completes with **8+ tool calls** (not 5 — a typical read→bash→edit→bash→read is already 5), trigger skill extraction via `pi.exec()`
|
|
203
|
+
- Additionally require at least **2 distinct tool types** in the turn (e.g., read + bash, not just 8 reads) to filter trivial multi-call turns
|
|
204
|
+
- Rate limit: max 1 auto-trigger per session
|
|
205
|
+
|
|
206
|
+
**`src/handlers/skills-command.ts`** (~50 lines)
|
|
207
|
+
- `/memory-skills` command listing all skills
|
|
208
|
+
|
|
209
|
+
**Test files**: `tests/store/skill-store.test.ts`, `tests/tools/skill-tool.test.ts`, `tests/handlers/skill-auto-trigger.test.ts`
|
|
210
|
+
|
|
211
|
+
### Modified Files
|
|
212
|
+
|
|
213
|
+
**`src/constants.ts`** — Add `SKILL_TOOL_DESCRIPTION`, `DEFAULT_SKILL_TRIGGER_TOOL_CALLS` (= 8); update `COMBINED_REVIEW_PROMPT`:
|
|
214
|
+
|
|
215
|
+
```typescript
|
|
216
|
+
export const COMBINED_REVIEW_PROMPT = `Review the conversation above and consider two things:
|
|
217
|
+
|
|
218
|
+
**Memory**: Has the user revealed things about themselves — their persona, desires, preferences, or personal details? Has the user expressed expectations about how you should behave, their work style, or ways they want you to operate? If so, save using memory_add.
|
|
219
|
+
|
|
220
|
+
**Skills**: Was a complex, non-trivial approach used to complete a task — one that required trial and error, multiple tool calls, or changing course? If so, save a reusable procedure using the skill tool with action 'create'. Include: when to use it, step-by-step procedure, pitfalls to avoid, and how to verify success.
|
|
221
|
+
|
|
222
|
+
Only act if there's something genuinely worth saving. If nothing stands out, just say 'Nothing to save.' and stop.`;
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
**Note on pi.exec() child tools**: The child `pi` process loads the same installed extension, so it has access to the memory write tools and `skill_manage`. This is the same mechanism that makes the existing memory tools work in background review.
|
|
226
|
+
|
|
227
|
+
**`src/index.ts`** — Wire SkillStore, registerSkillTool, setupSkillAutoTrigger, registerSkillsCommand; inject skill index into system prompt at `before_agent_start`. Pass `config.memoryDir + "/skills/"` directly to SkillStore constructor (no memoryDirPath getter needed).
|
|
228
|
+
|
|
229
|
+
### Progressive Disclosure
|
|
230
|
+
- **System prompt**: Skill index only (name + description per skill, ~3K tokens max)
|
|
231
|
+
- **On demand**: Agent calls `skill` tool with action `view` to load full content
|
|
232
|
+
- **Frozen snapshot**: Index captured at `session_start`, same as memory snapshot
|
|
233
|
+
|
|
234
|
+
### Key Decision: Frozen Snapshot for Skills
|
|
235
|
+
Skill index is captured at `session_start` and injected at `before_agent_start`. New skills created mid-session appear in the index on next session. This preserves Pi's prompt cache.
|
|
236
|
+
|
|
237
|
+
---
|
|
238
|
+
|
|
239
|
+
## Epic 5: Documentation & Release
|
|
240
|
+
|
|
241
|
+
- Update `README.md` with new features, config options, commands
|
|
242
|
+
- Update `docs/ROADMAP.md` — mark v0.2 complete
|
|
243
|
+
- Bump `package.json` version to `0.2.0`
|
|
244
|
+
- `npm run check` passes, all tests pass
|
|
245
|
+
- Tag `v0.2.0`
|
|
246
|
+
|
|
247
|
+
---
|
|
248
|
+
|
|
249
|
+
## File Change Summary
|
|
250
|
+
|
|
251
|
+
### New Files (12)
|
|
252
|
+
| File | Lines | Epic |
|
|
253
|
+
|---|---|---|
|
|
254
|
+
| `src/handlers/auto-consolidate.ts` | ~120 | 2 |
|
|
255
|
+
| `src/handlers/consolidate-command.ts` | ~30 | 2 |
|
|
256
|
+
| `src/handlers/correction-detector.ts` | ~100 | 3 |
|
|
257
|
+
| `src/store/skill-store.ts` | ~250 | 1 |
|
|
258
|
+
| `src/tools/skill-tool.ts` | ~180 | 1 |
|
|
259
|
+
| `src/handlers/skill-auto-trigger.ts` | ~80 | 1 |
|
|
260
|
+
| `src/handlers/skills-command.ts` | ~50 | 1 |
|
|
261
|
+
| `tests/handlers/auto-consolidate.test.ts` | ~120 | 2 |
|
|
262
|
+
| `tests/handlers/correction-detector.test.ts` | ~150 | 3 |
|
|
263
|
+
| `tests/store/skill-store.test.ts` | ~200 | 1 |
|
|
264
|
+
| `tests/tools/skill-tool.test.ts` | ~100 | 1 |
|
|
265
|
+
| `tests/handlers/skill-auto-trigger.test.ts` | ~80 | 1 |
|
|
266
|
+
|
|
267
|
+
### Modified Files (8)
|
|
268
|
+
| File | Epic(s) |
|
|
269
|
+
|---|---|
|
|
270
|
+
| `src/types.ts` | 2, 3, 4 |
|
|
271
|
+
| `src/constants.ts` | 1, 2, 3, 4 |
|
|
272
|
+
| `src/config.ts` | 2, 3, 4 |
|
|
273
|
+
| `src/store/memory-store.ts` | 1, 2 |
|
|
274
|
+
| `src/tools/memory-tool.ts` | 2 |
|
|
275
|
+
| `src/handlers/background-review.ts` | 4 |
|
|
276
|
+
| `src/index.ts` | 1, 2, 3, 4 |
|
|
277
|
+
| `tests/handlers/background-review.test.ts` | 4 |
|
|
278
|
+
|
|
279
|
+
---
|
|
280
|
+
|
|
281
|
+
## Verification
|
|
282
|
+
|
|
283
|
+
After each epic:
|
|
284
|
+
1. `npm run check` — zero type errors
|
|
285
|
+
2. `npm test` — all tests pass
|
|
286
|
+
3. Manual test: `pi -e ./src/index.ts` — verify the feature works in a live session
|
|
287
|
+
|
|
288
|
+
Final:
|
|
289
|
+
4. Full regression: all 119 existing tests + new tests pass
|
|
290
|
+
5. Tag v0.2.0
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
# Tasks — v0.2.0: Skills + Smart Curation
|
|
2
|
+
|
|
3
|
+
> **Workflow**: When you start a task, change `[ ]` to `[~]`. When done, change to `[x]` and note the commit hash.
|
|
4
|
+
>
|
|
5
|
+
> **Implementation order**: Epic 2 → Epic 3 → Epic 4 → Epic 1 → Epic 5 (quick wins first, then the largest piece)
|
|
6
|
+
>
|
|
7
|
+
> **Plan**: See `docs/0.2/PLAN.md` for full implementation details and architectural decisions.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Epic 2: Auto-Consolidation
|
|
12
|
+
|
|
13
|
+
_Done when: memory full no longer returns an error — it triggers automatic consolidation and retries the add._
|
|
14
|
+
|
|
15
|
+
### Shared Config (Epics 2-4 touch these files — do once, extend per epic)
|
|
16
|
+
- [x] `src/types.ts` — add `autoConsolidate: boolean` to `MemoryConfig`; add `ConsolidationResult` interface (`c6317dd`)
|
|
17
|
+
- [x] `src/config.ts` — add `autoConsolidate: true` default + parsing (`c6317dd`)
|
|
18
|
+
- [x] `src/constants.ts` — add `CONSOLIDATION_PROMPT` (`c6317dd`)
|
|
19
|
+
|
|
20
|
+
### Implementation
|
|
21
|
+
- [x] `src/store/memory-store.ts` — make `add()` async, add `setConsolidator()` injection method; after consolidation: `await this.loadFromDisk()` before retry (`c6317dd`)
|
|
22
|
+
- [x] `src/tools/memory-tool.ts` — `await store.add(target, content)` (`c6317dd`)
|
|
23
|
+
- [x] `src/handlers/auto-consolidate.ts` — `triggerConsolidation()` using `pi.exec()` pattern (`c6317dd`)
|
|
24
|
+
- [x] `src/handlers/consolidate-command.ts` — `/memory-consolidate` command (`c6317dd` — combined into `auto-consolidate.ts`)
|
|
25
|
+
- [x] `src/index.ts` — wire consolidator via `store.setConsolidator()` + register command (`c6317dd`)
|
|
26
|
+
|
|
27
|
+
### Tests
|
|
28
|
+
- [x] `tests/handlers/auto-consolidate.test.ts` — consolidation trigger, pi.exec call, success/failure paths (`83e7c46`)
|
|
29
|
+
- [x] `tests/store/memory-store.test.ts` — migrate all `store.add()` calls to `await store.add()`; consolidator tests (`83e7c46`)
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Epic 3: Correction Detection + Immediate Save
|
|
34
|
+
|
|
35
|
+
_Done when: user corrections are detected in real-time and trigger an immediate memory save._
|
|
36
|
+
|
|
37
|
+
### Config
|
|
38
|
+
- [x] `src/types.ts` — add `correctionDetection: boolean` to `MemoryConfig` (`c6317dd`)
|
|
39
|
+
- [x] `src/config.ts` — add `correctionDetection: true` default + parsing (`c6317dd`)
|
|
40
|
+
- [x] `src/constants.ts` — add `CORRECTION_SAVE_PROMPT`, strong/weak/negative pattern arrays (`c6317dd`)
|
|
41
|
+
|
|
42
|
+
### Implementation
|
|
43
|
+
- [x] `src/handlers/correction-detector.ts` — two-pass filter: strong/weak/negative patterns (`c6317dd`)
|
|
44
|
+
- [x] Rate limiting — `turnsSinceLastCorrection >= 3` and `!correctionInProgress` guard (`c6317dd`)
|
|
45
|
+
- [x] `src/index.ts` — wire `setupCorrectionDetector()` (`c6317dd`)
|
|
46
|
+
|
|
47
|
+
### Tests
|
|
48
|
+
- [x] `tests/handlers/correction-detector.test.ts` — 35 tests: strong/weak/negative patterns, rate limiting, false positives (`83e7c46`)
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## Epic 4: Tool-Call-Aware Nudge
|
|
53
|
+
|
|
54
|
+
_Done when: background review triggers based on EITHER turn count OR tool call count._
|
|
55
|
+
|
|
56
|
+
### Config
|
|
57
|
+
- [x] `src/types.ts` — add `nudgeToolCalls: number` to `MemoryConfig` (`c6317dd`)
|
|
58
|
+
- [x] `src/config.ts` — add `nudgeToolCalls: 15` default + parsing (`c6317dd`)
|
|
59
|
+
|
|
60
|
+
### Implementation
|
|
61
|
+
- [x] `src/handlers/background-review.ts` — count toolCall entries from branch; OR trigger logic; reset both counters (`c6317dd`)
|
|
62
|
+
|
|
63
|
+
### Tests
|
|
64
|
+
- [x] `tests/handlers/background-review.test.ts` — 6 new tests: tool-call trigger, combined trigger, counter reset, text-only, crash recovery (`83e7c46`)
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## Epic 1: Skill Tool + Procedural Memory
|
|
69
|
+
|
|
70
|
+
_Done when: the agent can create/update/delete skill documents, skills appear in a progressive index in the system prompt, and skills are auto-created after complex tasks._
|
|
71
|
+
|
|
72
|
+
### Research & Design
|
|
73
|
+
- [x] Read Pi's skill discovery API — Pi uses `~/.selesai/agent/skills/` with SKILL.md frontmatter format (`c6317dd`)
|
|
74
|
+
- [x] Decide: write to `~/.selesai/agent/memory/skills/` — isolated from user skills (`c6317dd`)
|
|
75
|
+
- [x] Read Hermes `skill_manage` tool source for reference patterns (`c6317dd`)
|
|
76
|
+
|
|
77
|
+
### Store
|
|
78
|
+
- [x] `src/store/skill-store.ts` — `SkillStore` class with full CRUD + `formatIndexForSystemPrompt()` (`c6317dd`)
|
|
79
|
+
- [x] SKILL.md format — frontmatter (name, description, version, created, updated) + markdown body (`c6317dd`)
|
|
80
|
+
- [x] File naming — `slugify(name) + ".md"` (`c6317dd`)
|
|
81
|
+
- [x] Frontmatter parsing — regex-based, no yaml dependency (`c6317dd`)
|
|
82
|
+
- [x] Content scanning — all writes go through `scanContent()` (`c6317dd`)
|
|
83
|
+
- [x] Atomic writes — temp+rename pattern (`c6317dd`)
|
|
84
|
+
|
|
85
|
+
### Tool
|
|
86
|
+
- [x] `src/tools/skill-tool.ts` — `registerSkillTool()` with actions: `create`, `view`, `patch`, `edit`, `delete` (`c6317dd`)
|
|
87
|
+
- [x] `src/constants.ts` — add `SKILL_TOOL_DESCRIPTION` and `DEFAULT_SKILL_TRIGGER_TOOL_CALLS` (= 8) (`c6317dd`)
|
|
88
|
+
- [x] Rewrite `COMBINED_REVIEW_PROMPT` — references skill tool with create/patch actions (`c6317dd`)
|
|
89
|
+
|
|
90
|
+
### Progressive Disclosure
|
|
91
|
+
- [x] Skill index (name + description only) injected into system prompt at `before_agent_start` (`c6317dd`)
|
|
92
|
+
- [x] `view` action loads full skill content on demand (`c6317dd`)
|
|
93
|
+
- [x] Frozen snapshot — index captured at `session_start`, consistent throughout session (`c6317dd`)
|
|
94
|
+
|
|
95
|
+
### Auto-Trigger
|
|
96
|
+
- [x] `src/handlers/skill-auto-trigger.ts` — 8+ tool calls with 2+ distinct tool types (`c6317dd`)
|
|
97
|
+
- [x] Rate limit — max 1 auto-trigger per session (`c6317dd`)
|
|
98
|
+
|
|
99
|
+
### Command
|
|
100
|
+
- [x] `src/handlers/skills-command.ts` — `/memory-skills` command (`c6317dd`)
|
|
101
|
+
|
|
102
|
+
### Wiring
|
|
103
|
+
- [x] `src/index.ts` — wire SkillStore, registerSkillTool, setupSkillAutoTrigger, registerSkillsCommand (`c6317dd`)
|
|
104
|
+
|
|
105
|
+
### Tests
|
|
106
|
+
- [x] `tests/store/skill-store.test.ts` — 27 tests: CRUD, frontmatter, progressive disclosure, atomic writes (`83e7c46`)
|
|
107
|
+
- [x] `tests/tools/skill-tool.test.ts` — 10 tests: registration, action dispatch, validation (`83e7c46`)
|
|
108
|
+
- [x] `tests/handlers/skill-auto-trigger.test.ts` — 6 tests: threshold, distinct types, session limit (`83e7c46`)
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## Epic 5: Documentation & Release
|
|
113
|
+
|
|
114
|
+
_Done when: v0.2.0 is tagged and released with updated docs._
|
|
115
|
+
|
|
116
|
+
- [x] Update `README.md` — skill tool, auto-consolidation, correction detection, new config, new commands (`4658529`)
|
|
117
|
+
- [x] Update `src/constants.ts` — verify all new prompts are finalized (`c6317dd`)
|
|
118
|
+
- [x] Update `docs/ROADMAP.md` — v0.2 roadmap documented (`d5b7518`)
|
|
119
|
+
- [x] `npm run check` passes with zero errors (`c6317dd`)
|
|
120
|
+
- [x] `npm test` — all 218 tests pass (`83e7c46`)
|
|
121
|
+
- [x] Bump `package.json` version to `0.2.0`
|
|
122
|
+
- [x] Tag v0.2.0 release
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
## Summary
|
|
127
|
+
|
|
128
|
+
| Epic | Priority | Est. Complexity | New Files | Modified Files |
|
|
129
|
+
|---|---|---|---|---|
|
|
130
|
+
| 2: Auto-Consolidation | HIGH | Low | 3 (src + test) | 5 (types, config, constants, memory-store, memory-tool, index) |
|
|
131
|
+
| 3: Correction Detection | HIGH | Low | 2 (src + test) | 3 (types, config, constants, index) |
|
|
132
|
+
| 4: Tool-Call Nudge | MEDIUM | Low | 0 | 3 (types, config, background-review, test) |
|
|
133
|
+
| 1: Skill Tool | CRITICAL | High | 8 (4 src + 4 test) | 3 (constants, index, memory-store) |
|
|
134
|
+
| 5: Documentation | NORMAL | Low | 0 | 4 (README, constants, ROADMAP, package.json) |
|