@accelerationguy/accel 1.0.0
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.md +19 -0
- package/LICENSE +33 -0
- package/README.md +275 -0
- package/bin/install.js +661 -0
- package/docs/getting-started.md +164 -0
- package/docs/module-guide.md +139 -0
- package/modules/drive/LICENSE +21 -0
- package/modules/drive/PAUL-VS-GSD.md +171 -0
- package/modules/drive/README.md +555 -0
- package/modules/drive/assets/terminal.svg +67 -0
- package/modules/drive/bin/install.js +210 -0
- package/modules/drive/integration.js +76 -0
- package/modules/drive/package.json +38 -0
- package/modules/drive/src/commands/add-phase.md +36 -0
- package/modules/drive/src/commands/apply.md +83 -0
- package/modules/drive/src/commands/assumptions.md +37 -0
- package/modules/drive/src/commands/audit.md +57 -0
- package/modules/drive/src/commands/complete-milestone.md +36 -0
- package/modules/drive/src/commands/config.md +175 -0
- package/modules/drive/src/commands/consider-issues.md +41 -0
- package/modules/drive/src/commands/discover.md +48 -0
- package/modules/drive/src/commands/discuss-milestone.md +33 -0
- package/modules/drive/src/commands/discuss.md +34 -0
- package/modules/drive/src/commands/flows.md +73 -0
- package/modules/drive/src/commands/handoff.md +201 -0
- package/modules/drive/src/commands/help.md +525 -0
- package/modules/drive/src/commands/init.md +54 -0
- package/modules/drive/src/commands/map-codebase.md +34 -0
- package/modules/drive/src/commands/milestone.md +34 -0
- package/modules/drive/src/commands/pause.md +44 -0
- package/modules/drive/src/commands/plan-fix.md +216 -0
- package/modules/drive/src/commands/plan.md +36 -0
- package/modules/drive/src/commands/progress.md +138 -0
- package/modules/drive/src/commands/register.md +29 -0
- package/modules/drive/src/commands/remove-phase.md +37 -0
- package/modules/drive/src/commands/research-phase.md +209 -0
- package/modules/drive/src/commands/research.md +47 -0
- package/modules/drive/src/commands/resume.md +49 -0
- package/modules/drive/src/commands/status.md +78 -0
- package/modules/drive/src/commands/unify.md +87 -0
- package/modules/drive/src/commands/verify.md +60 -0
- package/modules/drive/src/references/checkpoints.md +234 -0
- package/modules/drive/src/references/context-management.md +219 -0
- package/modules/drive/src/references/git-strategy.md +206 -0
- package/modules/drive/src/references/loop-phases.md +254 -0
- package/modules/drive/src/references/plan-format.md +263 -0
- package/modules/drive/src/references/quality-principles.md +152 -0
- package/modules/drive/src/references/research-quality-control.md +247 -0
- package/modules/drive/src/references/sonarqube-integration.md +244 -0
- package/modules/drive/src/references/specialized-workflow-integration.md +186 -0
- package/modules/drive/src/references/subagent-criteria.md +179 -0
- package/modules/drive/src/references/tdd.md +219 -0
- package/modules/drive/src/references/work-units.md +161 -0
- package/modules/drive/src/rules/commands.md +108 -0
- package/modules/drive/src/rules/references.md +107 -0
- package/modules/drive/src/rules/style.md +123 -0
- package/modules/drive/src/rules/templates.md +51 -0
- package/modules/drive/src/rules/workflows.md +133 -0
- package/modules/drive/src/templates/CONTEXT.md +88 -0
- package/modules/drive/src/templates/DEBUG.md +164 -0
- package/modules/drive/src/templates/DISCOVERY.md +148 -0
- package/modules/drive/src/templates/HANDOFF.md +77 -0
- package/modules/drive/src/templates/ISSUES.md +93 -0
- package/modules/drive/src/templates/MILESTONES.md +167 -0
- package/modules/drive/src/templates/PLAN.md +328 -0
- package/modules/drive/src/templates/PROJECT.md +219 -0
- package/modules/drive/src/templates/RESEARCH.md +130 -0
- package/modules/drive/src/templates/ROADMAP.md +328 -0
- package/modules/drive/src/templates/SPECIAL-FLOWS.md +70 -0
- package/modules/drive/src/templates/STATE.md +210 -0
- package/modules/drive/src/templates/SUMMARY.md +221 -0
- package/modules/drive/src/templates/UAT-ISSUES.md +139 -0
- package/modules/drive/src/templates/codebase/architecture.md +259 -0
- package/modules/drive/src/templates/codebase/concerns.md +329 -0
- package/modules/drive/src/templates/codebase/conventions.md +311 -0
- package/modules/drive/src/templates/codebase/integrations.md +284 -0
- package/modules/drive/src/templates/codebase/stack.md +190 -0
- package/modules/drive/src/templates/codebase/structure.md +287 -0
- package/modules/drive/src/templates/codebase/testing.md +484 -0
- package/modules/drive/src/templates/config.md +181 -0
- package/modules/drive/src/templates/milestone-archive.md +236 -0
- package/modules/drive/src/templates/milestone-context.md +190 -0
- package/modules/drive/src/templates/paul-json.md +147 -0
- package/modules/drive/src/vector-config/PAUL +26 -0
- package/modules/drive/src/vector-config/PAUL.manifest +11 -0
- package/modules/drive/src/workflows/apply-phase.md +393 -0
- package/modules/drive/src/workflows/audit-plan.md +344 -0
- package/modules/drive/src/workflows/complete-milestone.md +479 -0
- package/modules/drive/src/workflows/configure-special-flows.md +283 -0
- package/modules/drive/src/workflows/consider-issues.md +172 -0
- package/modules/drive/src/workflows/create-milestone.md +268 -0
- package/modules/drive/src/workflows/debug.md +292 -0
- package/modules/drive/src/workflows/discovery.md +187 -0
- package/modules/drive/src/workflows/discuss-milestone.md +245 -0
- package/modules/drive/src/workflows/discuss-phase.md +231 -0
- package/modules/drive/src/workflows/init-project.md +698 -0
- package/modules/drive/src/workflows/map-codebase.md +459 -0
- package/modules/drive/src/workflows/pause-work.md +259 -0
- package/modules/drive/src/workflows/phase-assumptions.md +181 -0
- package/modules/drive/src/workflows/plan-phase.md +385 -0
- package/modules/drive/src/workflows/quality-gate.md +263 -0
- package/modules/drive/src/workflows/register-manifest.md +107 -0
- package/modules/drive/src/workflows/research.md +241 -0
- package/modules/drive/src/workflows/resume-project.md +200 -0
- package/modules/drive/src/workflows/roadmap-management.md +334 -0
- package/modules/drive/src/workflows/transition-phase.md +368 -0
- package/modules/drive/src/workflows/unify-phase.md +290 -0
- package/modules/drive/src/workflows/verify-work.md +241 -0
- package/modules/forge/README.md +281 -0
- package/modules/forge/bin/install.js +200 -0
- package/modules/forge/package.json +32 -0
- package/modules/forge/skillsmith/rules/checklists-rules.md +42 -0
- package/modules/forge/skillsmith/rules/context-rules.md +43 -0
- package/modules/forge/skillsmith/rules/entry-point-rules.md +44 -0
- package/modules/forge/skillsmith/rules/frameworks-rules.md +43 -0
- package/modules/forge/skillsmith/rules/tasks-rules.md +52 -0
- package/modules/forge/skillsmith/rules/templates-rules.md +43 -0
- package/modules/forge/skillsmith/skillsmith.md +82 -0
- package/modules/forge/skillsmith/tasks/audit.md +277 -0
- package/modules/forge/skillsmith/tasks/discover.md +145 -0
- package/modules/forge/skillsmith/tasks/distill.md +276 -0
- package/modules/forge/skillsmith/tasks/scaffold.md +349 -0
- package/modules/forge/specs/checklists.md +193 -0
- package/modules/forge/specs/context.md +223 -0
- package/modules/forge/specs/entry-point.md +320 -0
- package/modules/forge/specs/frameworks.md +228 -0
- package/modules/forge/specs/rules.md +245 -0
- package/modules/forge/specs/tasks.md +344 -0
- package/modules/forge/specs/templates.md +335 -0
- package/modules/forge/terminal.svg +70 -0
- package/modules/ignition/README.md +245 -0
- package/modules/ignition/bin/install.js +184 -0
- package/modules/ignition/checklists/planning-quality.md +55 -0
- package/modules/ignition/data/application/config.md +21 -0
- package/modules/ignition/data/application/guide.md +51 -0
- package/modules/ignition/data/application/skill-loadout.md +11 -0
- package/modules/ignition/data/campaign/config.md +18 -0
- package/modules/ignition/data/campaign/guide.md +36 -0
- package/modules/ignition/data/campaign/skill-loadout.md +10 -0
- package/modules/ignition/data/client/config.md +18 -0
- package/modules/ignition/data/client/guide.md +36 -0
- package/modules/ignition/data/client/skill-loadout.md +11 -0
- package/modules/ignition/data/utility/config.md +18 -0
- package/modules/ignition/data/utility/guide.md +31 -0
- package/modules/ignition/data/utility/skill-loadout.md +8 -0
- package/modules/ignition/data/workflow/config.md +19 -0
- package/modules/ignition/data/workflow/guide.md +41 -0
- package/modules/ignition/data/workflow/skill-loadout.md +10 -0
- package/modules/ignition/integration.js +54 -0
- package/modules/ignition/package.json +35 -0
- package/modules/ignition/seed.md +81 -0
- package/modules/ignition/tasks/add-type.md +164 -0
- package/modules/ignition/tasks/graduate.md +182 -0
- package/modules/ignition/tasks/ideate.md +221 -0
- package/modules/ignition/tasks/launch.md +137 -0
- package/modules/ignition/tasks/status.md +71 -0
- package/modules/ignition/templates/planning-application.md +193 -0
- package/modules/ignition/templates/planning-campaign.md +138 -0
- package/modules/ignition/templates/planning-client.md +149 -0
- package/modules/ignition/templates/planning-utility.md +112 -0
- package/modules/ignition/templates/planning-workflow.md +125 -0
- package/modules/ignition/terminal.svg +74 -0
- package/modules/mission-control/CONTEXT-CONTINUITY-SPEC.md +293 -0
- package/modules/mission-control/CONTEXT-ENGINEERING-GUIDE.md +282 -0
- package/modules/mission-control/README.md +91 -0
- package/modules/mission-control/assets/terminal.svg +80 -0
- package/modules/mission-control/examples/entities.example.json +133 -0
- package/modules/mission-control/examples/projects.example.json +318 -0
- package/modules/mission-control/examples/state.example.json +183 -0
- package/modules/mission-control/examples/vector.example.json +245 -0
- package/modules/mission-control/mission-control/checklists/install-verification.md +46 -0
- package/modules/mission-control/mission-control/frameworks/framework-registry.md +83 -0
- package/modules/mission-control/mission-control/mission-control.md +83 -0
- package/modules/mission-control/mission-control/tasks/insights.md +73 -0
- package/modules/mission-control/mission-control/tasks/install.md +194 -0
- package/modules/mission-control/mission-control/tasks/status.md +125 -0
- package/modules/mission-control/schemas/entities.schema.json +89 -0
- package/modules/mission-control/schemas/projects.schema.json +221 -0
- package/modules/mission-control/schemas/state.schema.json +108 -0
- package/modules/mission-control/schemas/vector.schema.json +200 -0
- package/modules/momentum/README.md +678 -0
- package/modules/momentum/bin/install.js +563 -0
- package/modules/momentum/integration.js +131 -0
- package/modules/momentum/package.json +42 -0
- package/modules/momentum/schemas/entities.schema.json +89 -0
- package/modules/momentum/schemas/projects.schema.json +221 -0
- package/modules/momentum/schemas/state.schema.json +108 -0
- package/modules/momentum/src/commands/audit-claude-md.md +31 -0
- package/modules/momentum/src/commands/audit.md +33 -0
- package/modules/momentum/src/commands/groom.md +35 -0
- package/modules/momentum/src/commands/history.md +27 -0
- package/modules/momentum/src/commands/pulse.md +33 -0
- package/modules/momentum/src/commands/scaffold.md +33 -0
- package/modules/momentum/src/commands/status.md +28 -0
- package/modules/momentum/src/commands/surface-convert.md +35 -0
- package/modules/momentum/src/commands/surface-create.md +34 -0
- package/modules/momentum/src/commands/surface-list.md +27 -0
- package/modules/momentum/src/commands/vector-hygiene.md +33 -0
- package/modules/momentum/src/framework/context/momentum-principles.md +71 -0
- package/modules/momentum/src/framework/frameworks/audit-strategies.md +53 -0
- package/modules/momentum/src/framework/frameworks/satellite-registration.md +44 -0
- package/modules/momentum/src/framework/tasks/audit-claude-md.md +68 -0
- package/modules/momentum/src/framework/tasks/audit.md +64 -0
- package/modules/momentum/src/framework/tasks/groom.md +164 -0
- package/modules/momentum/src/framework/tasks/history.md +34 -0
- package/modules/momentum/src/framework/tasks/pulse.md +83 -0
- package/modules/momentum/src/framework/tasks/scaffold.md +202 -0
- package/modules/momentum/src/framework/tasks/status.md +35 -0
- package/modules/momentum/src/framework/tasks/surface-convert.md +143 -0
- package/modules/momentum/src/framework/tasks/surface-create.md +184 -0
- package/modules/momentum/src/framework/tasks/surface-list.md +42 -0
- package/modules/momentum/src/framework/tasks/vector-hygiene.md +160 -0
- package/modules/momentum/src/framework/templates/workspace-json.md +96 -0
- package/modules/momentum/src/hooks/_template.py +129 -0
- package/modules/momentum/src/hooks/active-hook.py +178 -0
- package/modules/momentum/src/hooks/backlog-hook.py +115 -0
- package/modules/momentum/src/hooks/mission-control-insights.py +169 -0
- package/modules/momentum/src/hooks/momentum-pulse-check.py +351 -0
- package/modules/momentum/src/hooks/operator.py +53 -0
- package/modules/momentum/src/hooks/psmm-injector.py +67 -0
- package/modules/momentum/src/hooks/satellite-detection.py +248 -0
- package/modules/momentum/src/packages/momentum-mcp/index.js +119 -0
- package/modules/momentum/src/packages/momentum-mcp/package.json +10 -0
- package/modules/momentum/src/packages/momentum-mcp/tools/entities.js +226 -0
- package/modules/momentum/src/packages/momentum-mcp/tools/operator.js +106 -0
- package/modules/momentum/src/packages/momentum-mcp/tools/projects.js +322 -0
- package/modules/momentum/src/packages/momentum-mcp/tools/psmm.js +206 -0
- package/modules/momentum/src/packages/momentum-mcp/tools/state.js +199 -0
- package/modules/momentum/src/packages/momentum-mcp/tools/surfaces.js +404 -0
- package/modules/momentum/src/skill/momentum.md +111 -0
- package/modules/momentum/src/tasks/groom.md +164 -0
- package/modules/momentum/src/templates/operator.json +66 -0
- package/modules/momentum/src/templates/workspace.json +111 -0
- package/modules/momentum/terminal.svg +77 -0
- package/modules/radar/README.md +1552 -0
- package/modules/radar/commands/audit.md +233 -0
- package/modules/radar/commands/guardrails.md +194 -0
- package/modules/radar/commands/init.md +207 -0
- package/modules/radar/commands/playbook.md +176 -0
- package/modules/radar/commands/remediate.md +156 -0
- package/modules/radar/commands/report.md +172 -0
- package/modules/radar/commands/resume.md +176 -0
- package/modules/radar/commands/status.md +148 -0
- package/modules/radar/commands/transform.md +205 -0
- package/modules/radar/commands/validate.md +177 -0
- package/modules/radar/docs/ARCHITECTURE.md +336 -0
- package/modules/radar/docs/GETTING-STARTED.md +287 -0
- package/modules/radar/docs/standards/agents.md +197 -0
- package/modules/radar/docs/standards/commands.md +250 -0
- package/modules/radar/docs/standards/domains.md +191 -0
- package/modules/radar/docs/standards/personas.md +211 -0
- package/modules/radar/docs/standards/rules.md +218 -0
- package/modules/radar/docs/standards/runtime.md +445 -0
- package/modules/radar/docs/standards/schemas.md +269 -0
- package/modules/radar/docs/standards/tools.md +273 -0
- package/modules/radar/docs/standards/workflows.md +254 -0
- package/modules/radar/docs/terminal.svg +72 -0
- package/modules/radar/docs/validation/convention-compliance-report.md +183 -0
- package/modules/radar/docs/validation/cross-reference-report.md +195 -0
- package/modules/radar/docs/validation/validation-summary.md +118 -0
- package/modules/radar/docs/validation/version-manifest.yaml +363 -0
- package/modules/radar/install.sh +711 -0
- package/modules/radar/integration.js +53 -0
- package/modules/radar/src/core/agents/architect.md +25 -0
- package/modules/radar/src/core/agents/compliance-officer.md +25 -0
- package/modules/radar/src/core/agents/data-engineer.md +25 -0
- package/modules/radar/src/core/agents/devils-advocate.md +22 -0
- package/modules/radar/src/core/agents/performance-engineer.md +25 -0
- package/modules/radar/src/core/agents/principal-engineer.md +23 -0
- package/modules/radar/src/core/agents/reality-gap-analyst.md +22 -0
- package/modules/radar/src/core/agents/security-engineer.md +25 -0
- package/modules/radar/src/core/agents/senior-app-engineer.md +25 -0
- package/modules/radar/src/core/agents/sre.md +25 -0
- package/modules/radar/src/core/agents/staff-engineer.md +23 -0
- package/modules/radar/src/core/agents/test-engineer.md +25 -0
- package/modules/radar/src/core/personas/architect.md +111 -0
- package/modules/radar/src/core/personas/compliance-officer.md +104 -0
- package/modules/radar/src/core/personas/data-engineer.md +113 -0
- package/modules/radar/src/core/personas/devils-advocate.md +105 -0
- package/modules/radar/src/core/personas/performance-engineer.md +119 -0
- package/modules/radar/src/core/personas/principal-engineer.md +119 -0
- package/modules/radar/src/core/personas/reality-gap-analyst.md +111 -0
- package/modules/radar/src/core/personas/security-engineer.md +108 -0
- package/modules/radar/src/core/personas/senior-app-engineer.md +111 -0
- package/modules/radar/src/core/personas/sre.md +117 -0
- package/modules/radar/src/core/personas/staff-engineer.md +109 -0
- package/modules/radar/src/core/personas/test-engineer.md +109 -0
- package/modules/radar/src/core/workflows/disagreement-resolution.md +183 -0
- package/modules/radar/src/core/workflows/phase-0-context.md +148 -0
- package/modules/radar/src/core/workflows/phase-1-reconnaissance.md +169 -0
- package/modules/radar/src/core/workflows/phase-2-domain-audits.md +190 -0
- package/modules/radar/src/core/workflows/phase-3-cross-domain.md +177 -0
- package/modules/radar/src/core/workflows/phase-4-adversarial-review.md +165 -0
- package/modules/radar/src/core/workflows/phase-5-report.md +189 -0
- package/modules/radar/src/core/workflows/phase-checkpoint.md +222 -0
- package/modules/radar/src/core/workflows/session-handoff.md +152 -0
- package/modules/radar/src/domains/00-context.md +201 -0
- package/modules/radar/src/domains/01-architecture.md +248 -0
- package/modules/radar/src/domains/02-data.md +224 -0
- package/modules/radar/src/domains/03-correctness.md +230 -0
- package/modules/radar/src/domains/04-security.md +274 -0
- package/modules/radar/src/domains/05-compliance.md +228 -0
- package/modules/radar/src/domains/06-testing.md +228 -0
- package/modules/radar/src/domains/07-reliability.md +246 -0
- package/modules/radar/src/domains/08-performance.md +247 -0
- package/modules/radar/src/domains/09-maintainability.md +271 -0
- package/modules/radar/src/domains/10-operability.md +250 -0
- package/modules/radar/src/domains/11-change-risk.md +246 -0
- package/modules/radar/src/domains/12-team-risk.md +221 -0
- package/modules/radar/src/domains/13-risk-synthesis.md +202 -0
- package/modules/radar/src/rules/agent-boundaries.md +78 -0
- package/modules/radar/src/rules/disagreement-protocol.md +76 -0
- package/modules/radar/src/rules/epistemic-hygiene.md +78 -0
- package/modules/radar/src/schemas/confidence.md +185 -0
- package/modules/radar/src/schemas/disagreement.md +238 -0
- package/modules/radar/src/schemas/finding.md +287 -0
- package/modules/radar/src/schemas/report-section.md +150 -0
- package/modules/radar/src/schemas/signal.md +108 -0
- package/modules/radar/src/tools/checkov.md +463 -0
- package/modules/radar/src/tools/git-history.md +581 -0
- package/modules/radar/src/tools/gitleaks.md +447 -0
- package/modules/radar/src/tools/grype.md +611 -0
- package/modules/radar/src/tools/semgrep.md +378 -0
- package/modules/radar/src/tools/sonarqube.md +550 -0
- package/modules/radar/src/tools/syft.md +539 -0
- package/modules/radar/src/tools/trivy.md +439 -0
- package/modules/radar/src/transform/agents/change-risk-modeler.md +24 -0
- package/modules/radar/src/transform/agents/execution-validator.md +24 -0
- package/modules/radar/src/transform/agents/guardrail-generator.md +24 -0
- package/modules/radar/src/transform/agents/pedagogy-agent.md +24 -0
- package/modules/radar/src/transform/agents/remediation-architect.md +24 -0
- package/modules/radar/src/transform/personas/change-risk-modeler.md +95 -0
- package/modules/radar/src/transform/personas/execution-validator.md +95 -0
- package/modules/radar/src/transform/personas/guardrail-generator.md +103 -0
- package/modules/radar/src/transform/personas/pedagogy-agent.md +105 -0
- package/modules/radar/src/transform/personas/remediation-architect.md +95 -0
- package/modules/radar/src/transform/rules/change-risk-rules.md +87 -0
- package/modules/radar/src/transform/rules/safety-governance.md +87 -0
- package/modules/radar/src/transform/schemas/change-risk.md +139 -0
- package/modules/radar/src/transform/schemas/intervention-level.md +207 -0
- package/modules/radar/src/transform/schemas/playbook.md +205 -0
- package/modules/radar/src/transform/schemas/verification-plan.md +134 -0
- package/modules/radar/src/transform/workflows/phase-6-remediation.md +148 -0
- package/modules/radar/src/transform/workflows/phase-7-risk-validation.md +161 -0
- package/modules/radar/src/transform/workflows/phase-8-execution-planning.md +159 -0
- package/modules/radar/src/transform/workflows/transform-safety.md +158 -0
- package/modules/vector/.vector-template/sessions/.gitkeep +0 -0
- package/modules/vector/.vector-template/vector.json +72 -0
- package/modules/vector/AUDIT-CLAUDEMD.md +154 -0
- package/modules/vector/INSTALL.md +185 -0
- package/modules/vector/LICENSE +21 -0
- package/modules/vector/README.md +409 -0
- package/modules/vector/VECTOR-BLOCK.md +57 -0
- package/modules/vector/assets/terminal.svg +68 -0
- package/modules/vector/bin/install.js +455 -0
- package/modules/vector/bin/migrate-v1-to-v2.sh +492 -0
- package/modules/vector/commands/help.md +46 -0
- package/modules/vector/hooks/vector-hook.py +775 -0
- package/modules/vector/mcp/index.js +118 -0
- package/modules/vector/mcp/package.json +10 -0
- package/modules/vector/mcp/tools/decisions.js +269 -0
- package/modules/vector/mcp/tools/domains.js +361 -0
- package/modules/vector/mcp/tools/staging.js +252 -0
- package/modules/vector/mcp/tools/vector-json.js +647 -0
- package/modules/vector/package.json +38 -0
- package/modules/vector/schemas/vector.schema.json +237 -0
- package/package.json +39 -0
- package/shared/branding/branding.js +70 -0
- package/shared/config/defaults.json +59 -0
- package/shared/events/README.md +175 -0
- package/shared/events/event-bus.js +134 -0
- package/shared/events/event_bus.py +255 -0
- package/shared/events/integrations.js +161 -0
- package/shared/events/schemas/audit-complete.schema.json +21 -0
- package/shared/events/schemas/phase-progress.schema.json +23 -0
- package/shared/events/schemas/plan-created.schema.json +21 -0
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Operator CRUD tools for .accel/momentum/operator.json
|
|
3
|
+
* Read, update sections, toggle hook activation
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import fs from 'fs';
|
|
7
|
+
import path from 'path';
|
|
8
|
+
|
|
9
|
+
function debugLog(...args) {
|
|
10
|
+
console.error('[Momentum:operator]', new Date().toISOString(), ...args);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function getOperatorPath(workspacePath) {
|
|
14
|
+
return path.join(workspacePath, '.accel/momentum', 'operator.json');
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function readOperator(workspacePath) {
|
|
18
|
+
const filepath = getOperatorPath(workspacePath);
|
|
19
|
+
try {
|
|
20
|
+
return JSON.parse(fs.readFileSync(filepath, 'utf8'));
|
|
21
|
+
} catch (error) {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function writeOperator(workspacePath, data) {
|
|
27
|
+
const filepath = getOperatorPath(workspacePath);
|
|
28
|
+
data.last_updated = new Date().toISOString();
|
|
29
|
+
fs.writeFileSync(filepath, JSON.stringify(data, null, 2) + '\n');
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// ============================================================
|
|
33
|
+
// TOOL DEFINITIONS
|
|
34
|
+
// ============================================================
|
|
35
|
+
|
|
36
|
+
export const TOOLS = [
|
|
37
|
+
{
|
|
38
|
+
name: "momentum_get_operator",
|
|
39
|
+
description: "Read the full operator profile from .accel/momentum/operator.json. Returns identity, deep why, north star, values, pitch, vision.",
|
|
40
|
+
inputSchema: { type: "object", properties: {}, required: [] }
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
name: "momentum_update_operator",
|
|
44
|
+
description: "Update a specific section of the operator profile. Sections: deep_why, north_star, key_values, elevator_pitch, surface_vision, extensions, hook_active. Pass the full section object to replace it.",
|
|
45
|
+
inputSchema: {
|
|
46
|
+
type: "object",
|
|
47
|
+
properties: {
|
|
48
|
+
section: { type: "string", description: "Section to update (deep_why, north_star, key_values, elevator_pitch, surface_vision, extensions, hook_active)" },
|
|
49
|
+
data: { description: "New section data (object for sections, boolean for hook_active)" }
|
|
50
|
+
},
|
|
51
|
+
required: ["section", "data"]
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
];
|
|
55
|
+
|
|
56
|
+
// ============================================================
|
|
57
|
+
// TOOL HANDLERS
|
|
58
|
+
// ============================================================
|
|
59
|
+
|
|
60
|
+
async function handleGetOperator(_args, workspacePath) {
|
|
61
|
+
const data = readOperator(workspacePath);
|
|
62
|
+
if (!data) {
|
|
63
|
+
return { error: "No operator.json found. Run /momentum:orientation to create one." };
|
|
64
|
+
}
|
|
65
|
+
return data;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
async function handleUpdateOperator(args, workspacePath) {
|
|
69
|
+
const { section, data: sectionData } = args;
|
|
70
|
+
if (!section) throw new Error('Missing required parameter: section');
|
|
71
|
+
if (sectionData === undefined) throw new Error('Missing required parameter: data');
|
|
72
|
+
|
|
73
|
+
const validSections = ['deep_why', 'north_star', 'key_values', 'elevator_pitch', 'surface_vision', 'extensions', 'hook_active'];
|
|
74
|
+
if (!validSections.includes(section)) {
|
|
75
|
+
throw new Error(`Invalid section "${section}". Valid: ${validSections.join(', ')}`);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const operator = readOperator(workspacePath);
|
|
79
|
+
if (!operator) {
|
|
80
|
+
throw new Error('No operator.json found. Run /momentum:orientation to create one.');
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
debugLog('Updating operator section:', section);
|
|
84
|
+
|
|
85
|
+
if (section === 'hook_active') {
|
|
86
|
+
operator.hook_active = !!sectionData;
|
|
87
|
+
} else {
|
|
88
|
+
operator[section] = sectionData;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
writeOperator(workspacePath, operator);
|
|
92
|
+
|
|
93
|
+
return {
|
|
94
|
+
section,
|
|
95
|
+
updated: true,
|
|
96
|
+
hook_active: operator.hook_active
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export async function handleTool(name, args, workspacePath) {
|
|
101
|
+
switch (name) {
|
|
102
|
+
case 'momentum_get_operator': return handleGetOperator(args, workspacePath);
|
|
103
|
+
case 'momentum_update_operator': return handleUpdateOperator(args, workspacePath);
|
|
104
|
+
default: return null;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mission Control Projects — Hierarchy-aware CRUD for projects.json
|
|
3
|
+
* Supports Initiative > Project > Task with auto-ID by type
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { readFileSync, writeFileSync, existsSync } from 'fs';
|
|
7
|
+
import { join } from 'path';
|
|
8
|
+
|
|
9
|
+
function debugLog(...args) {
|
|
10
|
+
console.error('[Momentum:projects]', new Date().toISOString(), ...args);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// ============================================================
|
|
14
|
+
// HELPERS
|
|
15
|
+
// ============================================================
|
|
16
|
+
|
|
17
|
+
const TYPE_PREFIX = { initiative: 'INI', project: 'PRJ', task: 'TSK' };
|
|
18
|
+
|
|
19
|
+
function getProjectsPath(workspacePath) {
|
|
20
|
+
return join(workspacePath, '.accel/momentum', 'data', 'projects.json');
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function readProjects(workspacePath) {
|
|
24
|
+
const filepath = getProjectsPath(workspacePath);
|
|
25
|
+
if (!existsSync(filepath)) {
|
|
26
|
+
return { version: 1, workspace: '', last_modified: null, categories: [], items: [], archived: [] };
|
|
27
|
+
}
|
|
28
|
+
try {
|
|
29
|
+
return JSON.parse(readFileSync(filepath, 'utf-8'));
|
|
30
|
+
} catch (error) {
|
|
31
|
+
debugLog('Error reading projects.json:', error.message);
|
|
32
|
+
return { version: 1, workspace: '', last_modified: null, categories: [], items: [], archived: [] };
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function writeProjects(workspacePath, data) {
|
|
37
|
+
const filepath = getProjectsPath(workspacePath);
|
|
38
|
+
data.last_modified = new Date().toISOString();
|
|
39
|
+
writeFileSync(filepath, JSON.stringify(data, null, 2), 'utf-8');
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function generateProjectId(type, items) {
|
|
43
|
+
const prefix = TYPE_PREFIX[type];
|
|
44
|
+
if (!prefix) throw new Error(`Invalid type: ${type}. Valid: initiative, project, task`);
|
|
45
|
+
|
|
46
|
+
let max = 0;
|
|
47
|
+
for (const item of items) {
|
|
48
|
+
const match = (item.id || '').match(new RegExp(`^${prefix}-(\\d+)$`));
|
|
49
|
+
if (match) {
|
|
50
|
+
const num = parseInt(match[1], 10);
|
|
51
|
+
if (num > max) max = num;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return `${prefix}-${String(max + 1).padStart(3, '0')}`;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function formatTimestamp() {
|
|
58
|
+
return new Date().toISOString();
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// ============================================================
|
|
62
|
+
// TOOL DEFINITIONS
|
|
63
|
+
// ============================================================
|
|
64
|
+
|
|
65
|
+
export const TOOLS = [
|
|
66
|
+
{
|
|
67
|
+
name: "momentum_list_projects",
|
|
68
|
+
description: "List/filter project items. Supports filtering by type (initiative/project/task), status, priority, parent_id, and category.",
|
|
69
|
+
inputSchema: {
|
|
70
|
+
type: "object",
|
|
71
|
+
properties: {
|
|
72
|
+
type: { type: "string", enum: ["initiative", "project", "task"], description: "Filter by hierarchy level" },
|
|
73
|
+
status: { type: "string", description: "Filter by status (backlog, todo, in_progress, blocked, in_review, completed, deferred, archived)" },
|
|
74
|
+
priority: { type: "string", description: "Filter by priority (urgent, high, medium, low, ongoing)" },
|
|
75
|
+
parent_id: { type: "string", description: "Filter by parent item ID" },
|
|
76
|
+
category: { type: "string", description: "Filter by category" }
|
|
77
|
+
},
|
|
78
|
+
required: []
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
name: "momentum_get_project",
|
|
83
|
+
description: "Get a single project item by ID. Returns the full item object.",
|
|
84
|
+
inputSchema: {
|
|
85
|
+
type: "object",
|
|
86
|
+
properties: {
|
|
87
|
+
id: { type: "string", description: "Item ID (e.g., 'PRJ-001', 'INI-002', 'TSK-005')" }
|
|
88
|
+
},
|
|
89
|
+
required: ["id"]
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
name: "momentum_add_project",
|
|
94
|
+
description: "Add a new initiative, project, or task. Auto-generates ID by type (INI-NNN, PRJ-NNN, TSK-NNN). Sets created_at and updated_at.",
|
|
95
|
+
inputSchema: {
|
|
96
|
+
type: "object",
|
|
97
|
+
properties: {
|
|
98
|
+
type: { type: "string", enum: ["initiative", "project", "task"], description: "Hierarchy level" },
|
|
99
|
+
title: { type: "string", description: "Item title" },
|
|
100
|
+
parent_id: { type: "string", description: "Parent item ID (null for top-level initiatives)" },
|
|
101
|
+
status: { type: "string", enum: ["backlog", "todo", "in_progress", "blocked", "in_review", "completed", "deferred"], description: "Initial status (default: todo)" },
|
|
102
|
+
priority: { type: "string", enum: ["urgent", "high", "medium", "low", "ongoing"], description: "Priority level (default: medium)" },
|
|
103
|
+
category: { type: "string", description: "Category from workspace categories list" },
|
|
104
|
+
assignees: { type: "array", items: { type: "string" }, description: "Entity IDs to assign" },
|
|
105
|
+
description: { type: "string", description: "Extended description" },
|
|
106
|
+
location: { type: "string", description: "Workspace-relative path" },
|
|
107
|
+
due_date: { type: "string", description: "ISO date deadline" },
|
|
108
|
+
tags: { type: "array", items: { type: "string" }, description: "Free-form tags" }
|
|
109
|
+
},
|
|
110
|
+
required: ["type", "title"]
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
name: "momentum_update_project",
|
|
115
|
+
description: "Update an existing item's fields by ID. Shallow merge — only specified fields updated, others preserved.",
|
|
116
|
+
inputSchema: {
|
|
117
|
+
type: "object",
|
|
118
|
+
properties: {
|
|
119
|
+
id: { type: "string", description: "Item ID to update" },
|
|
120
|
+
data: { type: "object", description: "Fields to update (shallow merge)" }
|
|
121
|
+
},
|
|
122
|
+
required: ["id", "data"]
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
name: "momentum_archive_project",
|
|
127
|
+
description: "Archive an item by ID — moves from items[] to archived[] with outcome and timestamp.",
|
|
128
|
+
inputSchema: {
|
|
129
|
+
type: "object",
|
|
130
|
+
properties: {
|
|
131
|
+
id: { type: "string", description: "Item ID to archive" },
|
|
132
|
+
outcome: { type: "string", description: "What happened (shipped, killed, absorbed, etc.)" }
|
|
133
|
+
},
|
|
134
|
+
required: ["id", "outcome"]
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
name: "momentum_search_projects",
|
|
139
|
+
description: "Search project items by keyword. Case-insensitive substring match across title, description, notes, and tags.",
|
|
140
|
+
inputSchema: {
|
|
141
|
+
type: "object",
|
|
142
|
+
properties: {
|
|
143
|
+
query: { type: "string", description: "Search query (case-insensitive)" }
|
|
144
|
+
},
|
|
145
|
+
required: ["query"]
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
];
|
|
149
|
+
|
|
150
|
+
// ============================================================
|
|
151
|
+
// TOOL HANDLERS
|
|
152
|
+
// ============================================================
|
|
153
|
+
|
|
154
|
+
function handleListProjects(args, workspacePath) {
|
|
155
|
+
const data = readProjects(workspacePath);
|
|
156
|
+
let items = data.items;
|
|
157
|
+
|
|
158
|
+
if (args.type) items = items.filter(i => i.type === args.type);
|
|
159
|
+
if (args.status) items = items.filter(i => i.status === args.status);
|
|
160
|
+
if (args.priority) items = items.filter(i => i.priority === args.priority);
|
|
161
|
+
if (args.parent_id) items = items.filter(i => i.parent_id === args.parent_id);
|
|
162
|
+
if (args.category) items = items.filter(i => i.category === args.category);
|
|
163
|
+
|
|
164
|
+
return { items, count: items.length, total: data.items.length };
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
function handleGetProject(args, workspacePath) {
|
|
168
|
+
const { id } = args;
|
|
169
|
+
if (!id) throw new Error('Missing required parameter: id');
|
|
170
|
+
|
|
171
|
+
const data = readProjects(workspacePath);
|
|
172
|
+
const item = data.items.find(i => i.id === id);
|
|
173
|
+
if (!item) {
|
|
174
|
+
throw new Error(`Item "${id}" not found. Available IDs: ${data.items.map(i => i.id).slice(0, 20).join(', ')}${data.items.length > 20 ? '...' : ''}`);
|
|
175
|
+
}
|
|
176
|
+
return item;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
function handleAddProject(args, workspacePath) {
|
|
180
|
+
const { type, title } = args;
|
|
181
|
+
if (!type) throw new Error('Missing required parameter: type');
|
|
182
|
+
if (!title) throw new Error('Missing required parameter: title');
|
|
183
|
+
|
|
184
|
+
const data = readProjects(workspacePath);
|
|
185
|
+
const now = formatTimestamp();
|
|
186
|
+
const id = generateProjectId(type, data.items);
|
|
187
|
+
|
|
188
|
+
const newItem = {
|
|
189
|
+
id,
|
|
190
|
+
title,
|
|
191
|
+
type,
|
|
192
|
+
parent_id: args.parent_id || null,
|
|
193
|
+
status: args.status || 'todo',
|
|
194
|
+
priority: args.priority || 'medium',
|
|
195
|
+
category: args.category || null,
|
|
196
|
+
assignees: args.assignees || [],
|
|
197
|
+
start_date: null,
|
|
198
|
+
due_date: args.due_date || null,
|
|
199
|
+
created_at: now,
|
|
200
|
+
updated_at: now,
|
|
201
|
+
location: args.location || null,
|
|
202
|
+
blocked_by: null,
|
|
203
|
+
next: null,
|
|
204
|
+
notes: [],
|
|
205
|
+
tags: args.tags || [],
|
|
206
|
+
drive: null,
|
|
207
|
+
relations: [],
|
|
208
|
+
description: args.description || null
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
data.items.push(newItem);
|
|
212
|
+
writeProjects(workspacePath, data);
|
|
213
|
+
|
|
214
|
+
debugLog(`Added ${type} ${id}: ${title}`);
|
|
215
|
+
return newItem;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
function handleUpdateProject(args, workspacePath) {
|
|
219
|
+
const { id, data: updateData } = args;
|
|
220
|
+
if (!id) throw new Error('Missing required parameter: id');
|
|
221
|
+
if (!updateData) throw new Error('Missing required parameter: data');
|
|
222
|
+
|
|
223
|
+
const data = readProjects(workspacePath);
|
|
224
|
+
const index = data.items.findIndex(i => i.id === id);
|
|
225
|
+
if (index === -1) {
|
|
226
|
+
throw new Error(`Item "${id}" not found`);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
data.items[index] = {
|
|
230
|
+
...data.items[index],
|
|
231
|
+
...updateData,
|
|
232
|
+
id, // Prevent ID overwrite
|
|
233
|
+
updated_at: formatTimestamp()
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
writeProjects(workspacePath, data);
|
|
237
|
+
|
|
238
|
+
debugLog(`Updated ${id}`);
|
|
239
|
+
return data.items[index];
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
function handleArchiveProject(args, workspacePath) {
|
|
243
|
+
const { id, outcome } = args;
|
|
244
|
+
if (!id) throw new Error('Missing required parameter: id');
|
|
245
|
+
if (!outcome) throw new Error('Missing required parameter: outcome');
|
|
246
|
+
|
|
247
|
+
const data = readProjects(workspacePath);
|
|
248
|
+
const index = data.items.findIndex(i => i.id === id);
|
|
249
|
+
if (index === -1) {
|
|
250
|
+
throw new Error(`Item "${id}" not found`);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
const [item] = data.items.splice(index, 1);
|
|
254
|
+
const now = formatTimestamp();
|
|
255
|
+
|
|
256
|
+
if (!data.archived) data.archived = [];
|
|
257
|
+
data.archived.push({
|
|
258
|
+
id: item.id,
|
|
259
|
+
title: item.title,
|
|
260
|
+
outcome,
|
|
261
|
+
date: now.split('T')[0],
|
|
262
|
+
archived_at: now
|
|
263
|
+
});
|
|
264
|
+
|
|
265
|
+
writeProjects(workspacePath, data);
|
|
266
|
+
|
|
267
|
+
debugLog(`Archived ${id}: ${outcome}`);
|
|
268
|
+
return { id, title: item.title, outcome, archived_at: now };
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
function handleSearchProjects(args, workspacePath) {
|
|
272
|
+
const { query } = args;
|
|
273
|
+
if (!query) throw new Error('Missing required parameter: query');
|
|
274
|
+
|
|
275
|
+
const data = readProjects(workspacePath);
|
|
276
|
+
const queryLower = query.toLowerCase();
|
|
277
|
+
const results = [];
|
|
278
|
+
|
|
279
|
+
for (const item of data.items) {
|
|
280
|
+
const searchFields = [
|
|
281
|
+
item.title,
|
|
282
|
+
item.description,
|
|
283
|
+
...(item.tags || []),
|
|
284
|
+
...(item.notes || []).map(n => n.text)
|
|
285
|
+
].filter(Boolean).join(' ').toLowerCase();
|
|
286
|
+
|
|
287
|
+
if (searchFields.includes(queryLower)) {
|
|
288
|
+
results.push({
|
|
289
|
+
id: item.id,
|
|
290
|
+
title: item.title,
|
|
291
|
+
type: item.type,
|
|
292
|
+
status: item.status,
|
|
293
|
+
priority: item.priority
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
return { results, count: results.length, query };
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
// ============================================================
|
|
302
|
+
// HANDLER DISPATCH
|
|
303
|
+
// ============================================================
|
|
304
|
+
|
|
305
|
+
export function handleTool(name, args, workspacePath) {
|
|
306
|
+
switch (name) {
|
|
307
|
+
case 'momentum_list_projects':
|
|
308
|
+
return handleListProjects(args, workspacePath);
|
|
309
|
+
case 'momentum_get_project':
|
|
310
|
+
return handleGetProject(args, workspacePath);
|
|
311
|
+
case 'momentum_add_project':
|
|
312
|
+
return handleAddProject(args, workspacePath);
|
|
313
|
+
case 'momentum_update_project':
|
|
314
|
+
return handleUpdateProject(args, workspacePath);
|
|
315
|
+
case 'momentum_archive_project':
|
|
316
|
+
return handleArchiveProject(args, workspacePath);
|
|
317
|
+
case 'momentum_search_projects':
|
|
318
|
+
return handleSearchProjects(args, workspacePath);
|
|
319
|
+
default:
|
|
320
|
+
return null;
|
|
321
|
+
}
|
|
322
|
+
}
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Momentum PSMM — Per-Session Meta Memory tools
|
|
3
|
+
* Tracks significant meta moments across sessions.
|
|
4
|
+
* The injection hook (psmm-injector.py) re-injects entries into context every prompt.
|
|
5
|
+
* Vector connects only for graduation: PSMM entries can be staged as Vector rule proposals.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { readFileSync, writeFileSync, existsSync } from 'fs';
|
|
9
|
+
import { join } from 'path';
|
|
10
|
+
|
|
11
|
+
const VALID_TYPES = ['DECISION', 'CORRECTION', 'SHIFT', 'INSIGHT', 'COMMITMENT'];
|
|
12
|
+
|
|
13
|
+
function debugLog(...args) {
|
|
14
|
+
console.error('[Momentum:psmm]', new Date().toISOString(), ...args);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function getPsmmPath(workspacePath) {
|
|
18
|
+
return join(workspacePath, '.accel/momentum', 'data', 'psmm.json');
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function readPsmm(workspacePath) {
|
|
22
|
+
const filepath = getPsmmPath(workspacePath);
|
|
23
|
+
if (!existsSync(filepath)) {
|
|
24
|
+
return { sessions: {} };
|
|
25
|
+
}
|
|
26
|
+
try {
|
|
27
|
+
return JSON.parse(readFileSync(filepath, 'utf-8'));
|
|
28
|
+
} catch (error) {
|
|
29
|
+
debugLog('Error reading psmm.json:', error.message);
|
|
30
|
+
return { sessions: {} };
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function writePsmm(workspacePath, data) {
|
|
35
|
+
const filepath = getPsmmPath(workspacePath);
|
|
36
|
+
writeFileSync(filepath, JSON.stringify(data, null, 2), 'utf-8');
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function formatTimestamp() {
|
|
40
|
+
const now = new Date();
|
|
41
|
+
const pad = (n) => String(n).padStart(2, '0');
|
|
42
|
+
return `${now.getFullYear()}-${pad(now.getMonth() + 1)}-${pad(now.getDate())} ${pad(now.getHours())}:${pad(now.getMinutes())}`;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// ============================================================
|
|
46
|
+
// TOOL DEFINITIONS
|
|
47
|
+
// ============================================================
|
|
48
|
+
|
|
49
|
+
export const TOOLS = [
|
|
50
|
+
{
|
|
51
|
+
name: "momentum_psmm_log",
|
|
52
|
+
description: "Log a per-session meta memory entry. Types: DECISION, CORRECTION, SHIFT, INSIGHT, COMMITMENT. Auto-creates session if new.",
|
|
53
|
+
inputSchema: {
|
|
54
|
+
type: "object",
|
|
55
|
+
properties: {
|
|
56
|
+
session_id: { type: "string", description: "Session UUID" },
|
|
57
|
+
type: { type: "string", enum: VALID_TYPES, description: "Entry type" },
|
|
58
|
+
text: { type: "string", description: "Description of the meta moment" }
|
|
59
|
+
},
|
|
60
|
+
required: ["session_id", "type", "text"]
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
name: "momentum_psmm_get",
|
|
65
|
+
description: "Get all PSMM entries for a specific session by UUID.",
|
|
66
|
+
inputSchema: {
|
|
67
|
+
type: "object",
|
|
68
|
+
properties: {
|
|
69
|
+
session_id: { type: "string", description: "Session UUID" }
|
|
70
|
+
},
|
|
71
|
+
required: ["session_id"]
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
name: "momentum_psmm_list",
|
|
76
|
+
description: "List all PSMM sessions with entry counts and created timestamps.",
|
|
77
|
+
inputSchema: { type: "object", properties: {} }
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
name: "momentum_psmm_clean",
|
|
81
|
+
description: "Remove a stale session's entries from PSMM.",
|
|
82
|
+
inputSchema: {
|
|
83
|
+
type: "object",
|
|
84
|
+
properties: {
|
|
85
|
+
session_id: { type: "string", description: "Session UUID to remove" }
|
|
86
|
+
},
|
|
87
|
+
required: ["session_id"]
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
];
|
|
91
|
+
|
|
92
|
+
// ============================================================
|
|
93
|
+
// TOOL HANDLERS
|
|
94
|
+
// ============================================================
|
|
95
|
+
|
|
96
|
+
export async function handleTool(name, args, workspacePath) {
|
|
97
|
+
switch (name) {
|
|
98
|
+
case "momentum_psmm_log": return psmmLog(args, workspacePath);
|
|
99
|
+
case "momentum_psmm_get": return psmmGet(args, workspacePath);
|
|
100
|
+
case "momentum_psmm_list": return psmmList(workspacePath);
|
|
101
|
+
case "momentum_psmm_clean": return psmmClean(args, workspacePath);
|
|
102
|
+
default: return null;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
async function psmmLog(args, workspacePath) {
|
|
107
|
+
const { session_id, type, text } = args;
|
|
108
|
+
|
|
109
|
+
if (!VALID_TYPES.includes(type)) {
|
|
110
|
+
return { success: false, error: `Invalid type: ${type}. Valid: ${VALID_TYPES.join(', ')}` };
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
debugLog('Logging PSMM entry:', session_id, type);
|
|
114
|
+
|
|
115
|
+
const data = readPsmm(workspacePath);
|
|
116
|
+
|
|
117
|
+
if (!data.sessions[session_id]) {
|
|
118
|
+
data.sessions[session_id] = {
|
|
119
|
+
created: formatTimestamp(),
|
|
120
|
+
entries: []
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
const entry = {
|
|
125
|
+
timestamp: formatTimestamp(),
|
|
126
|
+
type,
|
|
127
|
+
text
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
data.sessions[session_id].entries.push(entry);
|
|
131
|
+
writePsmm(workspacePath, data);
|
|
132
|
+
|
|
133
|
+
return {
|
|
134
|
+
success: true,
|
|
135
|
+
session_id,
|
|
136
|
+
entry_count: data.sessions[session_id].entries.length,
|
|
137
|
+
message: `Logged ${type} entry to session ${session_id.slice(0, 8)}...`
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
async function psmmGet(args, workspacePath) {
|
|
142
|
+
const { session_id } = args;
|
|
143
|
+
debugLog('Getting PSMM for session:', session_id);
|
|
144
|
+
|
|
145
|
+
const data = readPsmm(workspacePath);
|
|
146
|
+
const session = data.sessions[session_id];
|
|
147
|
+
|
|
148
|
+
if (!session) {
|
|
149
|
+
return { entries: [], exists: false };
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
return {
|
|
153
|
+
exists: true,
|
|
154
|
+
session_id,
|
|
155
|
+
created: session.created,
|
|
156
|
+
entry_count: session.entries.length,
|
|
157
|
+
entries: session.entries
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
async function psmmList(workspacePath) {
|
|
162
|
+
debugLog('Listing PSMM sessions');
|
|
163
|
+
|
|
164
|
+
const data = readPsmm(workspacePath);
|
|
165
|
+
const sessions = [];
|
|
166
|
+
|
|
167
|
+
for (const [id, session] of Object.entries(data.sessions)) {
|
|
168
|
+
sessions.push({
|
|
169
|
+
session_id: id,
|
|
170
|
+
created: session.created,
|
|
171
|
+
entry_count: session.entries.length,
|
|
172
|
+
types: [...new Set(session.entries.map(e => e.type))]
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
sessions.sort((a, b) => b.created.localeCompare(a.created));
|
|
177
|
+
|
|
178
|
+
return {
|
|
179
|
+
success: true,
|
|
180
|
+
session_count: sessions.length,
|
|
181
|
+
total_entries: sessions.reduce((sum, s) => sum + s.entry_count, 0),
|
|
182
|
+
sessions
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
async function psmmClean(args, workspacePath) {
|
|
187
|
+
const { session_id } = args;
|
|
188
|
+
debugLog('Cleaning PSMM session:', session_id);
|
|
189
|
+
|
|
190
|
+
const data = readPsmm(workspacePath);
|
|
191
|
+
|
|
192
|
+
if (!data.sessions[session_id]) {
|
|
193
|
+
return { success: false, error: `Session not found: ${session_id}` };
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
const entryCount = data.sessions[session_id].entries.length;
|
|
197
|
+
delete data.sessions[session_id];
|
|
198
|
+
writePsmm(workspacePath, data);
|
|
199
|
+
|
|
200
|
+
return {
|
|
201
|
+
success: true,
|
|
202
|
+
session_id,
|
|
203
|
+
entries_removed: entryCount,
|
|
204
|
+
message: `Cleaned session ${session_id.slice(0, 8)}... (${entryCount} entries removed)`
|
|
205
|
+
};
|
|
206
|
+
}
|