monomind 1.7.0 → 1.9.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/agents/design/design-monodesign.md +121 -0
- package/.claude/agents/github/issue-tracker.md +12 -12
- package/.claude/agents/github/pr-manager.md +10 -10
- package/.claude/agents/github/release-manager.md +49 -105
- package/.claude/agents/github/repo-architect.md +73 -92
- package/.claude/agents/github/sync-coordinator.md +55 -123
- package/.claude/agents/marketing/marketing-competitive-content.md +155 -0
- package/.claude/agents/marketing/marketing-content-creator.md +13 -0
- package/.claude/agents/marketing/marketing-cro-specialist.md +147 -0
- package/.claude/agents/marketing/marketing-email-specialist.md +90 -0
- package/.claude/agents/marketing/marketing-launch-strategist.md +129 -0
- package/.claude/agents/marketing/marketing-pricing-strategist.md +127 -0
- package/.claude/agents/specialists/integration-architect.md +94 -0
- package/.claude/commands/agents/README.md +4 -0
- package/.claude/commands/agents/agent-capabilities.md +6 -2
- package/.claude/commands/agents/agent-coordination.md +4 -0
- package/.claude/commands/agents/agent-spawning.md +4 -0
- package/.claude/commands/agents/agent-types.md +6 -2
- package/.claude/commands/analysis/README.md +14 -5
- package/.claude/commands/analysis/bottleneck-detect.md +30 -123
- package/.claude/commands/analysis/performance-bottlenecks.md +14 -14
- package/.claude/commands/analysis/performance-report.md +38 -11
- package/.claude/commands/analysis/token-efficiency.md +13 -16
- package/.claude/commands/analysis/token-usage.md +34 -12
- package/.claude/commands/automation/README.md +15 -5
- package/.claude/commands/automation/auto-agent.md +49 -85
- package/.claude/commands/automation/self-healing.md +20 -18
- package/.claude/commands/automation/session-memory.md +28 -29
- package/.claude/commands/automation/smart-agents.md +17 -9
- package/.claude/commands/automation/smart-spawn.md +52 -11
- package/.claude/commands/automation/workflow-select.md +46 -11
- package/.claude/commands/browse.md +5 -0
- package/.claude/commands/coordination/README.md +9 -5
- package/.claude/commands/coordination/agent-spawn.md +53 -9
- package/.claude/commands/coordination/swarm-init.md +39 -42
- package/.claude/commands/coordination/task-orchestrate.md +65 -11
- package/.claude/commands/github/README.md +21 -8
- package/.claude/commands/github/github-modes.md +9 -5
- package/.claude/commands/github/issue-tracker.md +34 -33
- package/.claude/commands/github/pr-manager.md +20 -17
- package/.claude/commands/github/release-manager.md +37 -49
- package/.claude/commands/github/repo-architect.md +39 -41
- package/.claude/commands/github/sync-coordinator.md +45 -49
- package/.claude/commands/hive-mind/README.md +42 -17
- package/.claude/commands/hive-mind/hive-mind-consensus.md +68 -4
- package/.claude/commands/hive-mind/hive-mind-init.md +55 -5
- package/.claude/commands/hive-mind/hive-mind-memory.md +69 -4
- package/.claude/commands/hive-mind/hive-mind-spawn.md +71 -10
- package/.claude/commands/hive-mind/hive-mind-status.md +52 -4
- package/.claude/commands/hive-mind/hive-mind-stop.md +51 -4
- package/.claude/commands/hive-mind/hive-mind.md +74 -14
- package/.claude/commands/hooks/README.md +62 -7
- package/.claude/commands/hooks/overview.md +94 -35
- package/.claude/commands/hooks/post-edit.md +48 -87
- package/.claude/commands/hooks/post-task.md +37 -87
- package/.claude/commands/hooks/pre-edit.md +52 -84
- package/.claude/commands/hooks/pre-task.md +46 -81
- package/.claude/commands/hooks/session-end.md +49 -85
- package/.claude/commands/hooks/setup.md +87 -58
- package/.claude/commands/mastermind/_repeat.md +308 -0
- package/.claude/commands/mastermind/architect.md +49 -0
- package/.claude/commands/mastermind/brain.md +98 -0
- package/.claude/commands/mastermind/build.md +22 -0
- package/.claude/commands/mastermind/content.md +22 -0
- package/.claude/commands/mastermind/createorg.md +94 -0
- package/.claude/commands/mastermind/finance.md +22 -0
- package/.claude/commands/mastermind/idea.md +22 -0
- package/.claude/commands/mastermind/marketing.md +22 -0
- package/.claude/commands/mastermind/master.md +379 -0
- package/.claude/commands/mastermind/ops.md +22 -0
- package/.claude/commands/mastermind/release.md +22 -0
- package/.claude/commands/mastermind/research.md +22 -0
- package/.claude/commands/mastermind/review.md +22 -0
- package/.claude/commands/mastermind/runorg.md +106 -0
- package/.claude/commands/mastermind/sales.md +22 -0
- package/.claude/commands/mastermind/techport.md +17 -0
- package/.claude/commands/memory/README.md +75 -5
- package/.claude/commands/memory/memory-search.md +63 -11
- package/.claude/commands/monitoring/README.md +64 -4
- package/.claude/commands/monitoring/agent-metrics.md +50 -10
- package/.claude/commands/monitoring/agents.md +59 -32
- package/.claude/commands/monitoring/status.md +96 -34
- package/.claude/commands/monograph/README.md +102 -0
- package/.claude/commands/monograph/monograph-build.md +79 -0
- package/.claude/commands/monograph/monograph-search.md +96 -0
- package/.claude/commands/monograph/monograph-stats.md +53 -0
- package/.claude/commands/monograph/monograph-watch.md +63 -0
- package/.claude/commands/monograph/monograph-wiki.md +91 -0
- package/.claude/commands/monomind/createtask.md +277 -0
- package/.claude/commands/{monomind-do.md → monomind/do.md} +22 -9
- package/.claude/commands/monomind/help.md +118 -0
- package/.claude/commands/{monomind-idea.md → monomind/idea.md} +23 -29
- package/.claude/commands/{monomind-improve.md → monomind/improve.md} +24 -30
- package/.claude/commands/monomind/memory.md +230 -0
- package/.claude/commands/monomind/repeat.md +201 -0
- package/.claude/commands/monomind/review.md +313 -0
- package/.claude/commands/monomind/specialagents.md +125 -0
- package/.claude/commands/monomind/swarm.md +161 -0
- package/.claude/commands/monomind/understand.md +148 -0
- package/.claude/commands/optimization/README.md +69 -5
- package/.claude/commands/optimization/auto-topology.md +66 -43
- package/.claude/commands/optimization/parallel-execution.md +65 -39
- package/.claude/commands/optimization/performance-optimize.md +79 -0
- package/.claude/commands/pair/README.md +48 -230
- package/.claude/commands/pair/examples.md +85 -441
- package/.claude/commands/pair/modes.md +77 -303
- package/.claude/commands/pair/session.md +76 -359
- package/.claude/commands/sparc/analyzer.md +9 -26
- package/.claude/commands/sparc/architect.md +8 -25
- package/.claude/commands/sparc/ask.md +27 -68
- package/.claude/commands/sparc/batch-executor.md +8 -25
- package/.claude/commands/sparc/code.md +12 -53
- package/.claude/commands/sparc/coder.md +8 -25
- package/.claude/commands/sparc/debug.md +12 -53
- package/.claude/commands/sparc/debugger.md +8 -25
- package/.claude/commands/sparc/designer.md +8 -25
- package/.claude/commands/sparc/devops.md +16 -57
- package/.claude/commands/sparc/docs-writer.md +12 -53
- package/.claude/commands/sparc/documenter.md +8 -25
- package/.claude/commands/sparc/innovator.md +8 -25
- package/.claude/commands/sparc/integration.md +12 -53
- package/.claude/commands/sparc/mcp.md +12 -53
- package/.claude/commands/sparc/memory-manager.md +28 -25
- package/.claude/commands/sparc/optimizer.md +8 -25
- package/.claude/commands/sparc/orchestrator.md +35 -97
- package/.claude/commands/sparc/post-deployment-monitoring-mode.md +13 -54
- package/.claude/commands/sparc/refinement-optimization-mode.md +13 -54
- package/.claude/commands/sparc/researcher.md +8 -25
- package/.claude/commands/sparc/reviewer.md +8 -25
- package/.claude/commands/sparc/security-review.md +13 -54
- package/.claude/commands/sparc/sparc-modes.md +97 -151
- package/.claude/commands/sparc/sparc.md +16 -56
- package/.claude/commands/sparc/spec-pseudocode.md +13 -54
- package/.claude/commands/sparc/supabase-admin.md +19 -66
- package/.claude/commands/sparc/swarm-coordinator.md +21 -25
- package/.claude/commands/sparc/tdd.md +8 -25
- package/.claude/commands/sparc/tester.md +8 -25
- package/.claude/commands/sparc/tutorial.md +12 -53
- package/.claude/commands/sparc/workflow-manager.md +8 -25
- package/.claude/commands/sparc.md +76 -130
- package/.claude/commands/stream-chain/pipeline.md +72 -77
- package/.claude/commands/stream-chain/run.md +133 -47
- package/.claude/commands/swarm/README.md +37 -12
- package/.claude/commands/swarm/analysis.md +47 -69
- package/.claude/commands/swarm/development.md +45 -69
- package/.claude/commands/swarm/examples.md +77 -142
- package/.claude/commands/swarm/maintenance.md +47 -74
- package/.claude/commands/swarm/optimization.md +54 -87
- package/.claude/commands/swarm/research.md +47 -107
- package/.claude/commands/swarm/swarm-analysis.md +58 -4
- package/.claude/commands/swarm/swarm-background.md +61 -4
- package/.claude/commands/swarm/swarm-modes.md +63 -4
- package/.claude/commands/swarm/swarm-monitor.md +50 -4
- package/.claude/commands/swarm/swarm-status.md +40 -4
- package/.claude/commands/swarm/swarm-strategies.md +73 -5
- package/.claude/commands/swarm/swarm.md +70 -18
- package/.claude/commands/swarm/testing.md +51 -102
- package/.claude/commands/tokens.md +6 -1
- package/.claude/commands/training/README.md +36 -6
- package/.claude/commands/training/model-update.md +68 -15
- package/.claude/commands/training/neural-patterns.md +54 -55
- package/.claude/commands/training/neural-train.md +70 -16
- package/.claude/commands/training/pattern-learn.md +60 -16
- package/.claude/commands/training/specialization.md +78 -49
- package/.claude/commands/truth/start.md +87 -109
- package/.claude/commands/ts.md +7 -2
- package/.claude/commands/verify/check.md +90 -34
- package/.claude/commands/verify/start.md +71 -94
- package/.claude/commands/workflows/README.md +62 -6
- package/.claude/commands/workflows/development.md +69 -61
- package/.claude/commands/workflows/research.md +73 -47
- package/.claude/commands/workflows/workflow-create.md +75 -16
- package/.claude/commands/workflows/workflow-execute.md +94 -16
- package/.claude/commands/workflows/workflow-export.md +81 -16
- package/.claude/helpers/control-start.cjs +91 -0
- package/.claude/helpers/extras-registry.json +4104 -1991
- package/.claude/helpers/graphify-freshen.cjs +44 -13
- package/.claude/helpers/hook-handler.cjs +256 -1
- package/.claude/helpers/loop-tracker.cjs +107 -0
- package/.claude/helpers/router.cjs +48 -68
- package/.claude/helpers/skill-registry.json +89 -104
- package/.claude/helpers/statusline.cjs +33 -2
- package/.claude/scheduled_tasks.lock +1 -0
- package/.claude/settings.json +15 -0
- package/.claude/skills/.monomind/data/ranked-context.json +5 -0
- package/.claude/skills/.monomind/sessions/current.json +13 -0
- package/.claude/skills/.monomind/sessions/session-1777829336455.json +15 -0
- package/.claude/skills/.monomind/sessions/session-1777831614725.json +15 -0
- package/.claude/skills/.monomind/sessions/session-1777832095857.json +15 -0
- package/.claude/skills/.monomind/sessions/session-1777839814183.json +15 -0
- package/.claude/skills/.monomind/sessions/session-1777841847131.json +15 -0
- package/.claude/skills/.monomind/sessions/session-1777843309463.json +15 -0
- package/.claude/skills/.monomind/sessions/session-1777880867159.json +15 -0
- package/.claude/skills/.monomind/sessions/session-1777881884593.json +15 -0
- package/.claude/skills/.monomind/sessions/session-1777884090471.json +15 -0
- package/.claude/skills/.monomind/sessions/session-1777884808221.json +15 -0
- package/.claude/skills/.monomind/sessions/session-1777885672155.json +15 -0
- package/.claude/skills/.monomind/sessions/session-1777886852818.json +15 -0
- package/.claude/skills/.monomind/sessions/session-1777896532690.json +15 -0
- package/.claude/skills/agentdb-advanced/SKILL.md +11 -12
- package/.claude/skills/agentdb-learning/SKILL.md +20 -21
- package/.claude/skills/agentdb-memory-patterns/SKILL.md +28 -30
- package/.claude/skills/agentdb-optimization/SKILL.md +11 -12
- package/.claude/skills/agentdb-vector-search/SKILL.md +37 -41
- package/.claude/skills/{v3-integration-deep → agentic-integration}/SKILL.md +20 -13
- package/.claude/skills/agentic-jujutsu/SKILL.md +22 -22
- package/.claude/skills/{v3-cli-modernization → cli-modernization}/SKILL.md +17 -8
- package/.claude/skills/{v3-core-implementation → core-implementation}/SKILL.md +33 -8
- package/.claude/skills/{v3-ddd-architecture → ddd-architecture}/SKILL.md +18 -25
- package/.claude/skills/github-code-review/SKILL.md +82 -83
- package/.claude/skills/github-multi-repo/SKILL.md +42 -46
- package/.claude/skills/github-project-management/SKILL.md +83 -88
- package/.claude/skills/github-release-management/SKILL.md +12 -18
- package/.claude/skills/github-workflow-automation/SKILL.md +70 -74
- package/.claude/skills/hooks-automation/SKILL.md +9 -13
- package/.claude/skills/mastermind/_intake.md +83 -0
- package/.claude/skills/mastermind/_protocol.md +275 -0
- package/.claude/skills/mastermind/architect.md +847 -0
- package/.claude/skills/mastermind/build.md +158 -0
- package/.claude/skills/mastermind/content.md +185 -0
- package/.claude/skills/mastermind/createorg.md +318 -0
- package/.claude/skills/mastermind/finance.md +154 -0
- package/.claude/skills/mastermind/idea.md +158 -0
- package/.claude/skills/mastermind/marketing.md +216 -0
- package/.claude/skills/mastermind/monotask.md +350 -0
- package/.claude/skills/mastermind/ops.md +156 -0
- package/.claude/skills/mastermind/references/copywriting-frameworks.md +181 -0
- package/.claude/skills/mastermind/references/persuasion-psychology.md +158 -0
- package/.claude/skills/mastermind/release.md +156 -0
- package/.claude/skills/mastermind/research.md +156 -0
- package/.claude/skills/mastermind/review.md +157 -0
- package/.claude/skills/mastermind/runorg.md +308 -0
- package/.claude/skills/mastermind/sales.md +158 -0
- package/.claude/skills/mastermind/techport.md +743 -0
- package/.claude/skills/{v3-mcp-optimization → mcp-optimization}/SKILL.md +35 -14
- package/.claude/skills/{v3-memory-unification → memory-unification}/SKILL.md +20 -4
- package/.claude/skills/monodesign/SKILL.md +302 -0
- package/.claude/skills/monodesign/reference/adapt.md +190 -0
- package/.claude/skills/monodesign/reference/animate.md +175 -0
- package/.claude/skills/monodesign/reference/antipatterns-catalog.md +187 -0
- package/.claude/skills/monodesign/reference/audit.md +133 -0
- package/.claude/skills/monodesign/reference/bolder.md +113 -0
- package/.claude/skills/monodesign/reference/brand-workflow.md +180 -0
- package/.claude/skills/monodesign/reference/brand.md +114 -0
- package/.claude/skills/monodesign/reference/clarify.md +174 -0
- package/.claude/skills/monodesign/reference/cognitive-load.md +106 -0
- package/.claude/skills/monodesign/reference/color-and-contrast.md +105 -0
- package/.claude/skills/monodesign/reference/colorize.md +154 -0
- package/.claude/skills/monodesign/reference/component-specs.md +260 -0
- package/.claude/skills/monodesign/reference/component-states.md +274 -0
- package/.claude/skills/monodesign/reference/component-system.md +358 -0
- package/.claude/skills/monodesign/reference/copy-formulas.md +160 -0
- package/.claude/skills/monodesign/reference/craft.md +193 -0
- package/.claude/skills/monodesign/reference/critique.md +213 -0
- package/.claude/skills/monodesign/reference/delight.md +302 -0
- package/.claude/skills/monodesign/reference/design-principles.md +246 -0
- package/.claude/skills/monodesign/reference/distill.md +111 -0
- package/.claude/skills/monodesign/reference/document.md +427 -0
- package/.claude/skills/monodesign/reference/extract.md +69 -0
- package/.claude/skills/monodesign/reference/harden.md +347 -0
- package/.claude/skills/monodesign/reference/heuristics-scoring.md +234 -0
- package/.claude/skills/monodesign/reference/image-prompts.md +118 -0
- package/.claude/skills/monodesign/reference/interaction-design.md +195 -0
- package/.claude/skills/monodesign/reference/layout.md +141 -0
- package/.claude/skills/monodesign/reference/live.md +622 -0
- package/.claude/skills/monodesign/reference/motion-design.md +109 -0
- package/.claude/skills/monodesign/reference/onboard.md +234 -0
- package/.claude/skills/monodesign/reference/optimize.md +258 -0
- package/.claude/skills/monodesign/reference/overdrive.md +130 -0
- package/.claude/skills/monodesign/reference/personas.md +179 -0
- package/.claude/skills/monodesign/reference/polish.md +233 -0
- package/.claude/skills/monodesign/reference/pre-delivery-checklist.md +108 -0
- package/.claude/skills/monodesign/reference/product.md +62 -0
- package/.claude/skills/monodesign/reference/quieter.md +99 -0
- package/.claude/skills/monodesign/reference/responsive-design.md +114 -0
- package/.claude/skills/monodesign/reference/shape.md +151 -0
- package/.claude/skills/monodesign/reference/spatial-design.md +100 -0
- package/.claude/skills/monodesign/reference/teach.md +156 -0
- package/.claude/skills/monodesign/reference/token-architecture.md +222 -0
- package/.claude/skills/monodesign/reference/typeset.md +124 -0
- package/.claude/skills/monodesign/reference/typography.md +159 -0
- package/.claude/skills/monodesign/reference/ux-research.md +143 -0
- package/.claude/skills/monodesign/reference/ux-rules.md +211 -0
- package/.claude/skills/monodesign/reference/ux-writing.md +107 -0
- package/.claude/skills/monomotion/SKILL.md +145 -0
- package/.claude/skills/monomotion/rules/api-control.md +139 -0
- package/.claude/skills/monomotion/rules/effects.md +109 -0
- package/.claude/skills/monomotion/rules/integration.md +140 -0
- package/.claude/skills/monomotion/rules/scroll.md +131 -0
- package/.claude/skills/monomotion/rules/sequencing.md +105 -0
- package/.claude/skills/monomotion/rules/svg.md +101 -0
- package/.claude/skills/monomotion/rules/text.md +119 -0
- package/.claude/skills/pair-programming/SKILL.md +1 -1
- package/.claude/skills/performance-analysis/SKILL.md +3 -3
- package/.claude/skills/{v3-performance-optimization → performance-optimization}/SKILL.md +16 -8
- package/.claude/skills/reasoningbank-agentdb/SKILL.md +17 -19
- package/.claude/skills/reasoningbank-intelligence/SKILL.md +4 -6
- package/.claude/skills/{v3-security-overhaul → security-hardening}/SKILL.md +13 -3
- package/.claude/skills/skill-builder/SKILL.md +19 -19
- package/.claude/skills/sparc-methodology/SKILL.md +55 -211
- package/.claude/skills/stop-slop/SKILL.md +67 -0
- package/.claude/skills/stop-slop/references/examples.md +61 -0
- package/.claude/skills/stop-slop/references/phrases.md +130 -0
- package/.claude/skills/stop-slop/references/structures.md +136 -0
- package/.claude/skills/swarm-advanced/SKILL.md +13 -43
- package/.claude/skills/{v3-swarm-coordination → swarm-coordination}/SKILL.md +39 -21
- package/.claude/skills/swarm-orchestration/SKILL.md +12 -12
- package/.claude/skills/verification-quality/SKILL.md +5 -5
- package/README.md +5 -5
- package/package.json +1 -1
- package/packages/@monomind/cli/README.md +5 -5
- package/packages/@monomind/cli/bin/cli.js +78 -13
- package/packages/@monomind/cli/dist/src/agents/halt-signal.js +33 -7
- package/packages/@monomind/cli/dist/src/agents/managed-agent.js +5 -2
- package/packages/@monomind/cli/dist/src/agents/prompt-experiment.d.ts +3 -2
- package/packages/@monomind/cli/dist/src/agents/prompt-experiment.js +1 -1
- package/packages/@monomind/cli/dist/src/agents/prompt-version-manager.d.ts +5 -2
- package/packages/@monomind/cli/dist/src/agents/prompt-version-manager.js +26 -4
- package/packages/@monomind/cli/dist/src/agents/specialization-scorer.js +17 -9
- package/packages/@monomind/cli/dist/src/agents/trigger-scanner.d.ts +5 -3
- package/packages/@monomind/cli/dist/src/agents/trigger-scanner.js +58 -10
- package/packages/@monomind/cli/dist/src/agents/version-store.d.ts +0 -1
- package/packages/@monomind/cli/dist/src/agents/version-store.js +44 -21
- package/packages/@monomind/cli/dist/src/autopilot-state.js +79 -28
- package/packages/@monomind/cli/dist/src/benchmarks/benchmark-runner.d.ts +7 -2
- package/packages/@monomind/cli/dist/src/benchmarks/benchmark-runner.js +20 -8
- package/packages/@monomind/cli/dist/src/benchmarks/metric-evaluators.d.ts +2 -1
- package/packages/@monomind/cli/dist/src/benchmarks/metric-evaluators.js +25 -2
- package/packages/@monomind/cli/dist/src/commands/agent.js +6 -4
- package/packages/@monomind/cli/dist/src/commands/appliance-advanced.js +23 -0
- package/packages/@monomind/cli/dist/src/commands/autopilot.js +3 -3
- package/packages/@monomind/cli/dist/src/commands/benchmark.js +119 -8
- package/packages/@monomind/cli/dist/src/commands/claims.js +22 -14
- package/packages/@monomind/cli/dist/src/commands/config.js +32 -0
- package/packages/@monomind/cli/dist/src/commands/daemon.js +13 -11
- package/packages/@monomind/cli/dist/src/commands/deployment.js +21 -2
- package/packages/@monomind/cli/dist/src/commands/doctor.js +28 -62
- package/packages/@monomind/cli/dist/src/commands/embeddings.js +124 -48
- package/packages/@monomind/cli/dist/src/commands/hive-mind.js +15 -14
- package/packages/@monomind/cli/dist/src/commands/hooks.js +45 -41
- package/packages/@monomind/cli/dist/src/commands/index.d.ts +2 -0
- package/packages/@monomind/cli/dist/src/commands/index.js +20 -7
- package/packages/@monomind/cli/dist/src/commands/init.js +53 -19
- package/packages/@monomind/cli/dist/src/commands/mcp.js +31 -44
- package/packages/@monomind/cli/dist/src/commands/memory.js +47 -15
- package/packages/@monomind/cli/dist/src/commands/migrate.js +156 -108
- package/packages/@monomind/cli/dist/src/commands/monograph.d.ts +8 -0
- package/packages/@monomind/cli/dist/src/commands/monograph.js +526 -0
- package/packages/@monomind/cli/dist/src/commands/neural.js +96 -56
- package/packages/@monomind/cli/dist/src/commands/performance.js +30 -8
- package/packages/@monomind/cli/dist/src/commands/plugins.js +13 -37
- package/packages/@monomind/cli/dist/src/commands/process.js +25 -2
- package/packages/@monomind/cli/dist/src/commands/providers.js +37 -5
- package/packages/@monomind/cli/dist/src/commands/replay.js +4 -4
- package/packages/@monomind/cli/dist/src/commands/route.js +37 -5
- package/packages/@monomind/cli/dist/src/commands/ruvector/import.js +12 -2
- package/packages/@monomind/cli/dist/src/commands/ruvector/init.js +15 -0
- package/packages/@monomind/cli/dist/src/commands/ruvector/status.js +16 -3
- package/packages/@monomind/cli/dist/src/commands/security.js +342 -193
- package/packages/@monomind/cli/dist/src/commands/session.js +51 -8
- package/packages/@monomind/cli/dist/src/commands/start.js +18 -4
- package/packages/@monomind/cli/dist/src/commands/swarm.js +47 -36
- package/packages/@monomind/cli/dist/src/commands/tokens.js +11 -11
- package/packages/@monomind/cli/dist/src/commands/transfer-store.js +1 -1
- package/packages/@monomind/cli/dist/src/commands/workflow.js +31 -4
- package/packages/@monomind/cli/dist/src/config-adapter.d.ts +2 -1
- package/packages/@monomind/cli/dist/src/consensus/audit-writer.js +46 -13
- package/packages/@monomind/cli/dist/src/consensus/vote-signer.d.ts +0 -3
- package/packages/@monomind/cli/dist/src/consensus/vote-signer.js +9 -1
- package/packages/@monomind/cli/dist/src/dlq/dlq-reader.d.ts +4 -2
- package/packages/@monomind/cli/dist/src/dlq/dlq-reader.js +25 -8
- package/packages/@monomind/cli/dist/src/dlq/dlq-replayer.d.ts +10 -3
- package/packages/@monomind/cli/dist/src/dlq/dlq-replayer.js +50 -16
- package/packages/@monomind/cli/dist/src/dlq/dlq-writer.js +27 -5
- package/packages/@monomind/cli/dist/src/eval/dataset-manager.d.ts +2 -2
- package/packages/@monomind/cli/dist/src/eval/dataset-manager.js +26 -16
- package/packages/@monomind/cli/dist/src/eval/trace-collector.js +23 -3
- package/packages/@monomind/cli/dist/src/index.js +12 -10
- package/packages/@monomind/cli/dist/src/init/claudemd-generator.js +8 -8
- package/packages/@monomind/cli/dist/src/init/executor.js +163 -137
- package/packages/@monomind/cli/dist/src/init/helpers-generator.js +49 -36
- package/packages/@monomind/cli/dist/src/init/mcp-generator.js +3 -3
- package/packages/@monomind/cli/dist/src/init/settings-generator.js +10 -3
- package/packages/@monomind/cli/dist/src/init/shared-instructions-generator.js +18 -3
- package/packages/@monomind/cli/dist/src/init/statusline-generator.js +3 -1
- package/packages/@monomind/cli/dist/src/init/types.d.ts +35 -11
- package/packages/@monomind/cli/dist/src/init/types.js +5 -9
- package/packages/@monomind/cli/dist/src/interactive/interrupt.js +8 -3
- package/packages/@monomind/cli/dist/src/mcp/tool-registry.js +38 -4
- package/packages/@monomind/cli/dist/src/mcp-client.js +15 -6
- package/packages/@monomind/cli/dist/src/mcp-server.d.ts +9 -2
- package/packages/@monomind/cli/dist/src/mcp-server.js +182 -35
- package/packages/@monomind/cli/dist/src/mcp-tools/agent-tools.js +66 -34
- package/packages/@monomind/cli/dist/src/mcp-tools/agentdb-tools.js +34 -7
- package/packages/@monomind/cli/dist/src/mcp-tools/analyze-tools.js +25 -16
- package/packages/@monomind/cli/dist/src/mcp-tools/auto-install.js +4 -6
- package/packages/@monomind/cli/dist/src/mcp-tools/autopilot-tools.js +12 -2
- package/packages/@monomind/cli/dist/src/mcp-tools/browser-tools.js +199 -20
- package/packages/@monomind/cli/dist/src/mcp-tools/claims-tools.js +68 -18
- package/packages/@monomind/cli/dist/src/mcp-tools/config-tools.js +33 -5
- package/packages/@monomind/cli/dist/src/mcp-tools/coordination-tools.js +59 -4
- package/packages/@monomind/cli/dist/src/mcp-tools/daa-tools.js +46 -10
- package/packages/@monomind/cli/dist/src/mcp-tools/embeddings-tools.js +46 -5
- package/packages/@monomind/cli/dist/src/mcp-tools/github-tools.js +29 -16
- package/packages/@monomind/cli/dist/src/mcp-tools/graphify-tools.d.ts +4 -67
- package/packages/@monomind/cli/dist/src/mcp-tools/graphify-tools.js +40 -1250
- package/packages/@monomind/cli/dist/src/mcp-tools/guidance-tools.js +38 -10
- package/packages/@monomind/cli/dist/src/mcp-tools/hive-mind-tools.js +96 -33
- package/packages/@monomind/cli/dist/src/mcp-tools/hooks-tools.js +70 -37
- package/packages/@monomind/cli/dist/src/mcp-tools/index.d.ts +1 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/index.js +1 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/memory-tools.js +29 -13
- package/packages/@monomind/cli/dist/src/mcp-tools/monograph-tools.d.ts +9 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/monograph-tools.js +6306 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/neural-tools.js +121 -37
- package/packages/@monomind/cli/dist/src/mcp-tools/performance-tools.js +21 -8
- package/packages/@monomind/cli/dist/src/mcp-tools/progress-tools.js +10 -8
- package/packages/@monomind/cli/dist/src/mcp-tools/request-tracker.js +4 -1
- package/packages/@monomind/cli/dist/src/mcp-tools/ruvllm-tools.js +19 -8
- package/packages/@monomind/cli/dist/src/mcp-tools/session-tools.js +57 -17
- package/packages/@monomind/cli/dist/src/mcp-tools/swarm-tools.js +35 -17
- package/packages/@monomind/cli/dist/src/mcp-tools/system-tools.js +4 -3
- package/packages/@monomind/cli/dist/src/mcp-tools/task-tools.js +53 -13
- package/packages/@monomind/cli/dist/src/mcp-tools/terminal-tools.js +63 -14
- package/packages/@monomind/cli/dist/src/mcp-tools/transfer-tools.js +21 -16
- package/packages/@monomind/cli/dist/src/mcp-tools/workflow-tools.js +92 -23
- package/packages/@monomind/cli/dist/src/memory/ewc-consolidation.js +41 -10
- package/packages/@monomind/cli/dist/src/memory/intelligence.d.ts +2 -2
- package/packages/@monomind/cli/dist/src/memory/intelligence.js +39 -13
- package/packages/@monomind/cli/dist/src/memory/memory-bridge.d.ts +1 -0
- package/packages/@monomind/cli/dist/src/memory/memory-bridge.js +149 -56
- package/packages/@monomind/cli/dist/src/memory/memory-initializer.js +107 -45
- package/packages/@monomind/cli/dist/src/memory/sona-optimizer.d.ts +8 -1
- package/packages/@monomind/cli/dist/src/memory/sona-optimizer.js +25 -8
- package/packages/@monomind/cli/dist/src/observability/replay-reader.d.ts +40 -0
- package/packages/@monomind/cli/dist/src/observability/replay-reader.js +138 -0
- package/packages/@monomind/cli/dist/src/orchestration/routing-modes.js +35 -5
- package/packages/@monomind/cli/dist/src/parser.d.ts +8 -0
- package/packages/@monomind/cli/dist/src/parser.js +48 -14
- package/packages/@monomind/cli/dist/src/plugins/manager.js +112 -19
- package/packages/@monomind/cli/dist/src/plugins/store/discovery.d.ts +1 -1
- package/packages/@monomind/cli/dist/src/plugins/store/discovery.js +80 -62
- package/packages/@monomind/cli/dist/src/production/circuit-breaker.js +8 -1
- package/packages/@monomind/cli/dist/src/production/error-handler.d.ts +4 -2
- package/packages/@monomind/cli/dist/src/production/error-handler.js +27 -5
- package/packages/@monomind/cli/dist/src/production/monitoring.js +8 -4
- package/packages/@monomind/cli/dist/src/production/rate-limiter.js +30 -22
- package/packages/@monomind/cli/dist/src/ruvector/agent-wasm.js +2 -2
- package/packages/@monomind/cli/dist/src/ruvector/coverage-router.js +19 -9
- package/packages/@monomind/cli/dist/src/ruvector/diff-classifier.d.ts +1 -0
- package/packages/@monomind/cli/dist/src/ruvector/diff-classifier.js +26 -6
- package/packages/@monomind/cli/dist/src/ruvector/enhanced-model-router.js +24 -2
- package/packages/@monomind/cli/dist/src/ruvector/index.d.ts +1 -2
- package/packages/@monomind/cli/dist/src/ruvector/index.js +2 -2
- package/packages/@monomind/cli/dist/src/ruvector/model-router.d.ts +4 -2
- package/packages/@monomind/cli/dist/src/ruvector/model-router.js +30 -6
- package/packages/@monomind/cli/dist/src/ruvector/moe-router.d.ts +7 -0
- package/packages/@monomind/cli/dist/src/ruvector/moe-router.js +35 -12
- package/packages/@monomind/cli/dist/src/ruvector/q-learning-router.d.ts +7 -1
- package/packages/@monomind/cli/dist/src/ruvector/q-learning-router.js +40 -9
- package/packages/@monomind/cli/dist/src/services/claim-service.d.ts +3 -1
- package/packages/@monomind/cli/dist/src/services/claim-service.js +33 -2
- package/packages/@monomind/cli/dist/src/services/config-file-manager.d.ts +16 -2
- package/packages/@monomind/cli/dist/src/services/config-file-manager.js +105 -17
- package/packages/@monomind/cli/dist/src/services/container-worker-pool.js +51 -11
- package/packages/@monomind/cli/dist/src/services/headless-worker-executor.d.ts +7 -0
- package/packages/@monomind/cli/dist/src/services/headless-worker-executor.js +188 -45
- package/packages/@monomind/cli/dist/src/services/registry-api.js +62 -9
- package/packages/@monomind/cli/dist/src/services/ruvector-training.js +8 -0
- package/packages/@monomind/cli/dist/src/services/worker-daemon.d.ts +4 -1
- package/packages/@monomind/cli/dist/src/services/worker-daemon.js +112 -28
- package/packages/@monomind/cli/dist/src/services/worker-queue.d.ts +9 -2
- package/packages/@monomind/cli/dist/src/services/worker-queue.js +86 -5
- package/packages/@monomind/cli/dist/src/suggest.js +9 -0
- package/packages/@monomind/cli/dist/src/swarm/flow-enforcer.d.ts +5 -3
- package/packages/@monomind/cli/dist/src/swarm/flow-enforcer.js +17 -5
- package/packages/@monomind/cli/dist/src/swarm/flow-visualizer.d.ts +3 -0
- package/packages/@monomind/cli/dist/src/swarm/flow-visualizer.js +30 -6
- package/packages/@monomind/cli/dist/src/transfer/anonymization/index.js +5 -3
- package/packages/@monomind/cli/dist/src/transfer/export.js +5 -3
- package/packages/@monomind/cli/dist/src/transfer/ipfs/client.js +84 -7
- package/packages/@monomind/cli/dist/src/transfer/ipfs/upload.js +13 -4
- package/packages/@monomind/cli/dist/src/transfer/storage/gcs.js +19 -10
- package/packages/@monomind/cli/dist/src/transfer/store/discovery.d.ts +9 -2
- package/packages/@monomind/cli/dist/src/transfer/store/discovery.js +68 -13
- package/packages/@monomind/cli/dist/src/transfer/store/download.d.ts +15 -6
- package/packages/@monomind/cli/dist/src/transfer/store/download.js +113 -24
- package/packages/@monomind/cli/dist/src/transfer/store/publish.d.ts +1 -1
- package/packages/@monomind/cli/dist/src/transfer/store/publish.js +13 -14
- package/packages/@monomind/cli/dist/src/transfer/store/registry.d.ts +3 -3
- package/packages/@monomind/cli/dist/src/transfer/store/registry.js +32 -16
- package/packages/@monomind/cli/dist/src/update/checker.js +17 -4
- package/packages/@monomind/cli/dist/src/update/executor.js +25 -20
- package/packages/@monomind/cli/dist/src/update/rate-limiter.d.ts +11 -0
- package/packages/@monomind/cli/dist/src/update/rate-limiter.js +23 -3
- package/packages/@monomind/cli/dist/src/utils/parse-jsonl.d.ts +6 -0
- package/packages/@monomind/cli/dist/src/utils/parse-jsonl.js +22 -0
- package/packages/@monomind/cli/dist/src/workflow/condition-evaluator.js +37 -3
- package/packages/@monomind/cli/dist/src/workflow/dag-builder.js +27 -11
- package/packages/@monomind/cli/dist/src/workflow/dag-executor.js +51 -13
- package/packages/@monomind/cli/dist/src/workflow/dsl-schema.d.ts +3 -0
- package/packages/@monomind/cli/dist/src/workflow/dsl-schema.js +6 -2
- package/packages/@monomind/cli/dist/src/workflow/template-engine.js +7 -0
- package/packages/@monomind/cli/dist/src/workflow/workflow-executor.js +95 -14
- package/packages/@monomind/cli/package.json +5 -2
- package/packages/@monomind/guidance/README.md +0 -3
- package/packages/@monomind/shared/README.md +0 -1
- package/packages/@monomind/shared/dist/types/consensus-audit.d.ts +3 -1
- package/packages/README.md +15 -16
- package/.claude/agents/design/design-brand-guardian.md +0 -323
- package/.claude/agents/design/design-image-prompt-engineer.md +0 -237
- package/.claude/agents/design/design-inclusive-visuals-specialist.md +0 -72
- package/.claude/agents/design/design-ui-designer.md +0 -384
- package/.claude/agents/design/design-ux-architect.md +0 -470
- package/.claude/agents/design/design-ux-researcher.md +0 -330
- package/.claude/agents/design/design-visual-storyteller.md +0 -150
- package/.claude/agents/design/design-whimsy-injector.md +0 -439
- package/.claude/agents/v3/integration-architect.md +0 -338
- package/.claude/commands/analysis/COMMAND_COMPLIANCE_REPORT.md +0 -54
- package/.claude/commands/coordination/init.md +0 -44
- package/.claude/commands/coordination/orchestrate.md +0 -43
- package/.claude/commands/coordination/spawn.md +0 -45
- package/.claude/commands/github/code-review-swarm.md +0 -550
- package/.claude/commands/github/code-review.md +0 -25
- package/.claude/commands/github/github-swarm.md +0 -121
- package/.claude/commands/github/issue-triage.md +0 -25
- package/.claude/commands/github/multi-repo-swarm.md +0 -519
- package/.claude/commands/github/pr-enhance.md +0 -26
- package/.claude/commands/github/project-board-sync.md +0 -471
- package/.claude/commands/github/release-swarm.md +0 -590
- package/.claude/commands/github/repo-analyze.md +0 -25
- package/.claude/commands/github/swarm-issue.md +0 -482
- package/.claude/commands/github/swarm-pr.md +0 -310
- package/.claude/commands/github/workflow-automation.md +0 -468
- package/.claude/commands/hive-mind/hive-mind-metrics.md +0 -8
- package/.claude/commands/hive-mind/hive-mind-resume.md +0 -8
- package/.claude/commands/hive-mind/hive-mind-sessions.md +0 -8
- package/.claude/commands/hive-mind/hive-mind-wizard.md +0 -8
- package/.claude/commands/list-agents.md +0 -17
- package/.claude/commands/memory/memory-persist.md +0 -25
- package/.claude/commands/memory/memory-usage.md +0 -25
- package/.claude/commands/memory/neural.md +0 -47
- package/.claude/commands/metrics.md +0 -11
- package/.claude/commands/monitoring/real-time-view.md +0 -25
- package/.claude/commands/monitoring/swarm-monitor.md +0 -25
- package/.claude/commands/monomind-createtask.md +0 -302
- package/.claude/commands/monomind-help.md +0 -103
- package/.claude/commands/monomind-memory.md +0 -107
- package/.claude/commands/monomind-repeat.md +0 -149
- package/.claude/commands/monomind-swarm.md +0 -205
- package/.claude/commands/optimization/cache-manage.md +0 -25
- package/.claude/commands/optimization/topology-optimize.md +0 -25
- package/.claude/commands/pair/commands.md +0 -546
- package/.claude/commands/pair/config.md +0 -510
- package/.claude/commands/pair/start.md +0 -209
- package/.claude/commands/use-agent.md +0 -67
- package/.claude/skills/monomind-createtask/SKILL.md +0 -269
- package/.claude/skills/monomind-task-engine/SKILL.md +0 -358
- /package/.claude/agents/{v3 → specialists}/memory-specialist.md +0 -0
- /package/.claude/agents/{v3 → specialists}/performance-engineer.md +0 -0
- /package/.claude/agents/{v3 → specialists}/queen-coordinator.md +0 -0
- /package/.claude/agents/{v3 → specialists}/security-architect.md +0 -0
|
@@ -1,118 +1,82 @@
|
|
|
1
|
-
|
|
1
|
+
---
|
|
2
|
+
name: hooks:session-end
|
|
3
|
+
---
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
# hooks session-end
|
|
6
|
+
|
|
7
|
+
End the current session and persist state for later restoration.
|
|
4
8
|
|
|
5
9
|
## Usage
|
|
6
10
|
|
|
7
11
|
```bash
|
|
8
|
-
npx monomind
|
|
12
|
+
npx monomind hooks session-end [options]
|
|
9
13
|
```
|
|
10
14
|
|
|
11
15
|
## Options
|
|
12
16
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
- `--cleanup-temp` - Remove temporary files
|
|
17
|
+
| Flag | Short | Type | Default | Description |
|
|
18
|
+
|---|---|---|---|---|
|
|
19
|
+
| `--save-state` | `-s` | boolean | `true` | Save session state for restoration |
|
|
20
|
+
| `--format` | — | string | — | Output format: `json` |
|
|
18
21
|
|
|
19
22
|
## Examples
|
|
20
23
|
|
|
21
|
-
### Basic session end
|
|
22
|
-
|
|
23
24
|
```bash
|
|
24
|
-
|
|
25
|
-
|
|
25
|
+
# End and save session (default)
|
|
26
|
+
npx monomind hooks session-end
|
|
26
27
|
|
|
27
|
-
|
|
28
|
+
# End without saving state
|
|
29
|
+
npx monomind hooks session-end --save-state false
|
|
28
30
|
|
|
29
|
-
|
|
30
|
-
npx monomind
|
|
31
|
+
# JSON output
|
|
32
|
+
npx monomind hooks session-end --format json
|
|
31
33
|
```
|
|
32
34
|
|
|
33
|
-
|
|
35
|
+
## Output
|
|
34
36
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
37
|
+
Session summary including:
|
|
38
|
+
- Session ID and duration
|
|
39
|
+
- Tasks executed / succeeded / failed
|
|
40
|
+
- Commands executed, files modified, agents spawned
|
|
41
|
+
- State file path (if saved)
|
|
38
42
|
|
|
39
|
-
|
|
43
|
+
## Restore Later
|
|
40
44
|
|
|
41
45
|
```bash
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
## Features
|
|
46
|
-
|
|
47
|
-
### State Persistence
|
|
48
|
-
|
|
49
|
-
- Saves current context
|
|
50
|
-
- Stores open files
|
|
51
|
-
- Preserves task progress
|
|
52
|
-
- Maintains decisions
|
|
53
|
-
|
|
54
|
-
### Metric Export
|
|
55
|
-
|
|
56
|
-
- Session duration
|
|
57
|
-
- Commands executed
|
|
58
|
-
- Files modified
|
|
59
|
-
- Tokens consumed
|
|
60
|
-
- Performance data
|
|
46
|
+
# Restore most recent session
|
|
47
|
+
npx monomind hooks session-restore
|
|
61
48
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
- Work accomplished
|
|
65
|
-
- Key decisions made
|
|
66
|
-
- Problems solved
|
|
67
|
-
- Next steps identified
|
|
68
|
-
|
|
69
|
-
### Cleanup Operations
|
|
70
|
-
|
|
71
|
-
- Removes temp files
|
|
72
|
-
- Clears caches
|
|
73
|
-
- Frees resources
|
|
74
|
-
- Optimizes storage
|
|
75
|
-
|
|
76
|
-
## Integration
|
|
77
|
-
|
|
78
|
-
This hook is automatically called by Claude Code when:
|
|
79
|
-
|
|
80
|
-
- Ending a conversation
|
|
81
|
-
- Closing work session
|
|
82
|
-
- Before shutdown
|
|
83
|
-
- Switching contexts
|
|
84
|
-
|
|
85
|
-
Manual usage in agents:
|
|
86
|
-
|
|
87
|
-
```bash
|
|
88
|
-
# At session end
|
|
89
|
-
npx monomind hook session-end --session-id "your-session" --generate-summary
|
|
49
|
+
# Restore specific session
|
|
50
|
+
npx monomind hooks session-restore -i session-12345
|
|
90
51
|
```
|
|
91
52
|
|
|
92
|
-
##
|
|
53
|
+
## Claude Code Integration
|
|
93
54
|
|
|
94
|
-
|
|
55
|
+
Typically wired to run at conversation end:
|
|
95
56
|
|
|
96
57
|
```json
|
|
97
58
|
{
|
|
98
|
-
"
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
},
|
|
107
|
-
"summaryPath": "/sessions/dev-session-2024-summary.md",
|
|
108
|
-
"cleanedUp": true,
|
|
109
|
-
"nextSession": "dev-session-2025"
|
|
59
|
+
"hooks": {
|
|
60
|
+
"Stop": [{
|
|
61
|
+
"hooks": [{
|
|
62
|
+
"type": "command",
|
|
63
|
+
"command": "npx monomind hooks session-end"
|
|
64
|
+
}]
|
|
65
|
+
}]
|
|
66
|
+
}
|
|
110
67
|
}
|
|
111
68
|
```
|
|
112
69
|
|
|
70
|
+
## MCP Tool
|
|
71
|
+
|
|
72
|
+
```javascript
|
|
73
|
+
mcp__monomind__hooks_session_end({
|
|
74
|
+
saveState: true,
|
|
75
|
+
timestamp: Date.now()
|
|
76
|
+
})
|
|
77
|
+
```
|
|
78
|
+
|
|
113
79
|
## See Also
|
|
114
80
|
|
|
115
|
-
- `
|
|
116
|
-
- `
|
|
117
|
-
- `performance report` - Detailed metrics
|
|
118
|
-
- `memory backup` - State backup
|
|
81
|
+
- `hooks session-restore` — restore a previous session
|
|
82
|
+
- `hooks pre-task` / `hooks post-task` — task tracking within a session
|
|
@@ -1,39 +1,68 @@
|
|
|
1
|
-
|
|
1
|
+
---
|
|
2
|
+
name: hooks:setup
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Setting Up Monomind Hooks
|
|
2
6
|
|
|
3
7
|
## Quick Start
|
|
4
8
|
|
|
5
9
|
### 1. Initialize with Hooks
|
|
10
|
+
|
|
6
11
|
```bash
|
|
7
12
|
npx monomind init --hooks
|
|
8
13
|
```
|
|
9
14
|
|
|
10
|
-
This automatically creates
|
|
11
|
-
- `.claude/settings.json` with hook configurations
|
|
12
|
-
- Hook command documentation
|
|
13
|
-
- Default hook handlers
|
|
15
|
+
This automatically creates `.claude/settings.json` with hook configurations.
|
|
14
16
|
|
|
15
17
|
### 2. Test Hook Functionality
|
|
18
|
+
|
|
16
19
|
```bash
|
|
17
20
|
# Test pre-edit hook
|
|
18
|
-
npx monomind
|
|
21
|
+
npx monomind hooks pre-edit --file src/utils.ts
|
|
19
22
|
|
|
20
|
-
# Test
|
|
21
|
-
npx monomind
|
|
23
|
+
# Test pre-task hook
|
|
24
|
+
npx monomind hooks pre-task -d "Implement user authentication"
|
|
25
|
+
|
|
26
|
+
# Test route
|
|
27
|
+
npx monomind hooks route -t "Fix authentication bug"
|
|
22
28
|
```
|
|
23
29
|
|
|
24
30
|
### 3. Customize Hooks
|
|
25
31
|
|
|
26
|
-
Edit `.claude/settings.json` to
|
|
32
|
+
Edit `.claude/settings.json` to configure which hooks fire on which Claude Code events:
|
|
27
33
|
|
|
28
34
|
```json
|
|
29
35
|
{
|
|
30
36
|
"hooks": {
|
|
31
37
|
"PreToolUse": [
|
|
32
38
|
{
|
|
33
|
-
"matcher": "^Write$",
|
|
39
|
+
"matcher": "^(Write|Edit|MultiEdit)$",
|
|
40
|
+
"hooks": [{
|
|
41
|
+
"type": "command",
|
|
42
|
+
"command": "npx monomind hooks pre-edit --file '${tool.params.file_path}'"
|
|
43
|
+
}]
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"matcher": "^Bash$",
|
|
34
47
|
"hooks": [{
|
|
35
48
|
"type": "command",
|
|
36
|
-
"command": "npx monomind
|
|
49
|
+
"command": "npx monomind hooks pre-command --command '${tool.params.command}'"
|
|
50
|
+
}]
|
|
51
|
+
}
|
|
52
|
+
],
|
|
53
|
+
"PostToolUse": [
|
|
54
|
+
{
|
|
55
|
+
"matcher": "^(Write|Edit|MultiEdit)$",
|
|
56
|
+
"hooks": [{
|
|
57
|
+
"type": "command",
|
|
58
|
+
"command": "npx monomind hooks post-edit --file '${tool.params.file_path}' --success true"
|
|
59
|
+
}]
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"matcher": "^Bash$",
|
|
63
|
+
"hooks": [{
|
|
64
|
+
"type": "command",
|
|
65
|
+
"command": "npx monomind hooks post-command --command '${tool.params.command}' --success true"
|
|
37
66
|
}]
|
|
38
67
|
}
|
|
39
68
|
]
|
|
@@ -41,63 +70,63 @@ Edit `.claude/settings.json` to customize:
|
|
|
41
70
|
}
|
|
42
71
|
```
|
|
43
72
|
|
|
44
|
-
##
|
|
73
|
+
## Common Patterns
|
|
45
74
|
|
|
46
|
-
|
|
47
|
-
- `continue`: Whether to proceed (true/false)
|
|
48
|
-
- `reason`: Explanation for decision
|
|
49
|
-
- `metadata`: Additional context
|
|
75
|
+
### Task Tracking (manual)
|
|
50
76
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
"file": ".env.production",
|
|
58
|
-
"protection_level": "high"
|
|
59
|
-
}
|
|
60
|
-
}
|
|
77
|
+
```bash
|
|
78
|
+
# Record task start
|
|
79
|
+
npx monomind hooks pre-task -d "Implement auth module"
|
|
80
|
+
|
|
81
|
+
# After completing work, record result
|
|
82
|
+
npx monomind hooks post-task -i task-123 --success true
|
|
61
83
|
```
|
|
62
84
|
|
|
63
|
-
|
|
64
|
-
- Keep hooks lightweight (< 100ms)
|
|
65
|
-
- Use caching for repeated operations
|
|
66
|
-
- Batch related operations
|
|
67
|
-
- Run non-critical hooks asynchronously
|
|
85
|
+
### Route Before Spawning
|
|
68
86
|
|
|
69
|
-
## Debugging Hooks
|
|
70
87
|
```bash
|
|
71
|
-
#
|
|
72
|
-
|
|
88
|
+
# Get agent recommendation for a task
|
|
89
|
+
npx monomind hooks route -t "Optimize database queries"
|
|
73
90
|
|
|
74
|
-
#
|
|
75
|
-
npx monomind
|
|
91
|
+
# Understand why an agent was chosen
|
|
92
|
+
npx monomind hooks explain -t "Fix authentication bug"
|
|
76
93
|
```
|
|
77
94
|
|
|
78
|
-
|
|
95
|
+
### Bootstrap from Repository
|
|
79
96
|
|
|
80
|
-
|
|
81
|
-
|
|
97
|
+
```bash
|
|
98
|
+
# Pretrain on current repo (medium depth + embeddings)
|
|
99
|
+
npx monomind hooks pretrain
|
|
82
100
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
"type": "command",
|
|
89
|
-
"command": "npx monomind hook check-protected --file '${tool.params.file_path}'"
|
|
90
|
-
}]
|
|
91
|
-
}
|
|
101
|
+
# Deep analysis only, no embeddings
|
|
102
|
+
npx monomind hooks pretrain --depth deep --no-with-embeddings
|
|
103
|
+
|
|
104
|
+
# Generate optimized agent configs from pretrain data
|
|
105
|
+
npx monomind hooks build-agents
|
|
92
106
|
```
|
|
93
107
|
|
|
94
|
-
###
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
108
|
+
### Session Persistence
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
# At session end
|
|
112
|
+
npx monomind hooks session-end
|
|
113
|
+
|
|
114
|
+
# At session start (restores latest)
|
|
115
|
+
npx monomind hooks session-restore
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## Debugging
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
# Enable debug output
|
|
122
|
+
export MONOMIND_LOG_LEVEL=debug
|
|
123
|
+
|
|
124
|
+
# List all registered hooks
|
|
125
|
+
npx monomind hooks list
|
|
126
|
+
|
|
127
|
+
# View learning metrics
|
|
128
|
+
npx monomind hooks metrics
|
|
129
|
+
|
|
130
|
+
# Check background workers
|
|
131
|
+
npx monomind hooks worker list
|
|
132
|
+
```
|
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: _repeat
|
|
3
|
+
description: Shared inter-session repeat protocol. Referenced by mastermind and monomind commands via "Follow the Repeat Preamble/Postamble from _repeat.md".
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## Shared Repeat Protocol
|
|
7
|
+
|
|
8
|
+
Adds `--repeat <N> --wait <seconds>` inter-session looping to any command. Uses `ScheduleWakeup` to pause between runs and `.monomind/loops/<id>.json` for dashboard tracking.
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## REPEAT PREAMBLE
|
|
13
|
+
|
|
14
|
+
Apply immediately after flag extraction, before any other command logic.
|
|
15
|
+
|
|
16
|
+
### 1. Extract repeat flags
|
|
17
|
+
|
|
18
|
+
Extract and remove these flags from `$ARGUMENTS` before passing the remainder to the command's own parser:
|
|
19
|
+
|
|
20
|
+
| Flag | Variable | Default | Notes |
|
|
21
|
+
|---|---|---|---|
|
|
22
|
+
| `--repeat <N>` | `repeat_count` | `0` | N ≥ 2 activates repeat; N < 2 = disabled |
|
|
23
|
+
| `--wait <seconds>` | `wait_seconds` | `60` | Minimum 60 (enforced by ScheduleWakeup) |
|
|
24
|
+
| `--rep <N>` | `current_rep` | absent | Internal; injected by ScheduleWakeup on continuation runs |
|
|
25
|
+
| `--loop <id>` | `loop_id` | absent | Internal; preserves loop identity across runs |
|
|
26
|
+
|
|
27
|
+
### 2. If `--rep N` is present (continuation run)
|
|
28
|
+
|
|
29
|
+
- Set `current_rep` = N, `loop_id` from `--loop <id>`
|
|
30
|
+
- Set `is_continuation = true`
|
|
31
|
+
- The calling command MUST skip its empty-prompt check and intake when `is_continuation = true`
|
|
32
|
+
|
|
33
|
+
**Before proceeding, check for a pending HIL file:**
|
|
34
|
+
```bash
|
|
35
|
+
HIL_FILE=".monomind/loops/${LOOP_ID}-hil.md"
|
|
36
|
+
LOOP_HIL_PENDING=false
|
|
37
|
+
LOOP_HIL_ANSWERED=false
|
|
38
|
+
if [ -f "$HIL_FILE" ]; then
|
|
39
|
+
RESPONSES=$(grep -cE "^[[:space:]]*>[[:space:]]+[^[:space:]]" "$HIL_FILE" 2>/dev/null)
|
|
40
|
+
RESPONSES=${RESPONSES:-0}
|
|
41
|
+
if [ "$RESPONSES" -eq 0 ]; then
|
|
42
|
+
LOOP_HIL_PENDING=true
|
|
43
|
+
else
|
|
44
|
+
LOOP_HIL_ANSWERED=true
|
|
45
|
+
fi
|
|
46
|
+
fi
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
**If `LOOP_HIL_PENDING=true` (HIL file exists but unanswered):**
|
|
50
|
+
- Output: `[repeat] Loop paused before run <current_rep>/<repeat_count>: waiting for human responses in ${HIL_FILE}.`
|
|
51
|
+
- Update state file:
|
|
52
|
+
```bash
|
|
53
|
+
python3 -c "import json; f='.monomind/loops/${LOOP_ID}.json'; d=json.load(open(f)); d['status']='hil:pending'; open(f,'w').write(json.dumps(d,indent=2))" 2>/dev/null \
|
|
54
|
+
|| jq '.status="hil:pending"' ".monomind/loops/${LOOP_ID}.json" > ".monomind/loops/${LOOP_ID}.json.tmp" && mv ".monomind/loops/${LOOP_ID}.json.tmp" ".monomind/loops/${LOOP_ID}.json" 2>/dev/null || true
|
|
55
|
+
```
|
|
56
|
+
- Emit `loop:hil:waiting`:
|
|
57
|
+
```bash
|
|
58
|
+
curl -s -X POST "http://localhost:4242/api/mastermind/event" \
|
|
59
|
+
-H "Content-Type: application/json" \
|
|
60
|
+
-d "{\"type\":\"loop:hil:waiting\",\"loopId\":\"${LOOP_ID}\",\"hilFile\":\"${HIL_FILE}\",\"rep\":<current_rep>,\"ts\":$(date +%s)000}" || true
|
|
61
|
+
```
|
|
62
|
+
- Re-schedule a check (not a full run) using ScheduleWakeup:
|
|
63
|
+
- `delaySeconds`: `min(wait_seconds, 300)` — check at most every 5 minutes
|
|
64
|
+
- `prompt`: same full continuation prompt (same `--rep <N>`)
|
|
65
|
+
- `reason`: `"HIL pending for /<command> run <current_rep>/<repeat_count> — re-checking"`
|
|
66
|
+
- STOP. Do not execute the command yet.
|
|
67
|
+
|
|
68
|
+
**If `LOOP_HIL_ANSWERED=true` (human responded):**
|
|
69
|
+
- Output: `[repeat] Human response received. Archiving HIL file and resuming.`
|
|
70
|
+
- Archive: `mv "$HIL_FILE" ".monomind/loops/${LOOP_ID}-hil-resolved-$(date +%s).md"`
|
|
71
|
+
- Emit `loop:hil:resolved`:
|
|
72
|
+
```bash
|
|
73
|
+
curl -s -X POST "http://localhost:4242/api/mastermind/event" \
|
|
74
|
+
-H "Content-Type: application/json" \
|
|
75
|
+
-d "{\"type\":\"loop:hil:resolved\",\"loopId\":\"${LOOP_ID}\",\"rep\":<current_rep>,\"ts\":$(date +%s)000}" || true
|
|
76
|
+
```
|
|
77
|
+
- Update state file:
|
|
78
|
+
```bash
|
|
79
|
+
python3 -c "import json; f='.monomind/loops/${LOOP_ID}.json'; d=json.load(open(f)); d['status']='running'; open(f,'w').write(json.dumps(d,indent=2))" 2>/dev/null \
|
|
80
|
+
|| jq '.status="running"' ".monomind/loops/${LOOP_ID}.json" > ".monomind/loops/${LOOP_ID}.json.tmp" && mv ".monomind/loops/${LOOP_ID}.json.tmp" ".monomind/loops/${LOOP_ID}.json" 2>/dev/null || true
|
|
81
|
+
```
|
|
82
|
+
- Proceed to execute the command (output: `[repeat] Run <current_rep>/<repeat_count> of /<command> starting...`)
|
|
83
|
+
|
|
84
|
+
**If no HIL file:** Output: `[repeat] Run <current_rep>/<repeat_count> of /<command> starting...` and proceed to the command's core logic.
|
|
85
|
+
|
|
86
|
+
### 3. If `--rep` is absent and `repeat_count ≥ 2` (first run)
|
|
87
|
+
|
|
88
|
+
1. Generate loop ID and write state file:
|
|
89
|
+
```bash
|
|
90
|
+
mkdir -p .monomind/loops
|
|
91
|
+
# Portable millisecond timestamp (BSD date has no %N; GNU date has %3N)
|
|
92
|
+
NOW_MS=$(python3 -c 'import time;print(int(time.time()*1000))' 2>/dev/null || echo "$(date +%s)000")
|
|
93
|
+
LOOP_ID="<command_slug>-${NOW_MS}"
|
|
94
|
+
# Dashboard expects interval in MINUTES (rounded), maxReps as the total run count
|
|
95
|
+
INTERVAL_MIN=$(( (<wait_seconds> + 30) / 60 ))
|
|
96
|
+
PROMPT_JSON=$(printf '%s' "<prompt>" | python3 -c "import sys,json; print(json.dumps(sys.stdin.read()))" 2>/dev/null \
|
|
97
|
+
|| printf '%s' "<prompt>" | node -e "process.stdout.write(JSON.stringify(require('fs').readFileSync('/dev/stdin','utf8')))" 2>/dev/null \
|
|
98
|
+
|| printf '"%s"' "$(printf '%s' "<prompt>" | sed 's/\\/\\\\/g; s/"/\\"/g; s/$/\\n/g' | tr -d '\n' | sed 's/\\n$//')")
|
|
99
|
+
cat > ".monomind/loops/${LOOP_ID}.json" << EOF
|
|
100
|
+
{
|
|
101
|
+
"id": "${LOOP_ID}",
|
|
102
|
+
"sessionId": "${LOOP_ID}",
|
|
103
|
+
"type": "repeat",
|
|
104
|
+
"command": "/<command>",
|
|
105
|
+
"prompt": ${PROMPT_JSON},
|
|
106
|
+
"maxReps": <repeat_count>,
|
|
107
|
+
"interval": ${INTERVAL_MIN},
|
|
108
|
+
"wait": <wait_seconds>,
|
|
109
|
+
"currentRep": 1,
|
|
110
|
+
"startedAt": ${NOW_MS},
|
|
111
|
+
"lastRunAt": ${NOW_MS},
|
|
112
|
+
"nextRunAt": ${NOW_MS},
|
|
113
|
+
"status": "running",
|
|
114
|
+
"source": "_repeat.md"
|
|
115
|
+
}
|
|
116
|
+
EOF
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
2. Emit `loop:start` to dashboard (failure is non-fatal):
|
|
120
|
+
```bash
|
|
121
|
+
curl -s -X POST "http://localhost:4242/api/mastermind/event" \
|
|
122
|
+
-H "Content-Type: application/json" \
|
|
123
|
+
-d "{\"type\":\"loop:start\",\"loopId\":\"${LOOP_ID}\",\"command\":\"/<command>\",\"repeat\":<repeat_count>,\"wait\":<wait_seconds>,\"ts\":$(date +%s)000}" || true
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
3. Set `current_rep` = 1, `is_continuation` = false
|
|
127
|
+
4. Output: `[repeat] Starting <repeat_count> runs of /<command> (<wait_seconds>s between each). Run 1/<repeat_count>...`
|
|
128
|
+
|
|
129
|
+
### 4. If `repeat_count < 2`
|
|
130
|
+
|
|
131
|
+
No repeat behavior. Proceed normally. The REPEAT POSTAMBLE is a no-op.
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
## REPEAT POSTAMBLE
|
|
136
|
+
|
|
137
|
+
Apply after the command's core logic fully completes (after skill returns, after final step, etc.).
|
|
138
|
+
|
|
139
|
+
**If `repeat_count < 2`:** skip this section entirely.
|
|
140
|
+
|
|
141
|
+
**Otherwise:**
|
|
142
|
+
|
|
143
|
+
### 1. Check for stop request
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
[ -f ".monomind/loops/${LOOP_ID}.stop" ] && REPEAT_STOP=true
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
If `REPEAT_STOP=true`:
|
|
150
|
+
- Output: `[repeat] Stop requested. Halting after run <current_rep>/<repeat_count>.`
|
|
151
|
+
- `rm -f ".monomind/loops/${LOOP_ID}.json" ".monomind/loops/${LOOP_ID}.stop"`
|
|
152
|
+
- STOP.
|
|
153
|
+
|
|
154
|
+
### 2. Report this run complete
|
|
155
|
+
|
|
156
|
+
Output: `[repeat] Run <current_rep>/<repeat_count> complete.`
|
|
157
|
+
|
|
158
|
+
### 3. Detect HIL items from this run
|
|
159
|
+
|
|
160
|
+
Check for files written since this run started that signal human decisions are needed:
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
# Collect any humaninloop*.md files created or modified in the last 600 seconds
|
|
164
|
+
RECENT_HIL=$(find . -maxdepth 3 \( -name "humaninloop*.md" -o -name "humaninloopreview*.md" \) \
|
|
165
|
+
-newer ".monomind/loops/${LOOP_ID}.json" 2>/dev/null | head -10)
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
**If `RECENT_HIL` is non-empty (HIL items were written by this run):**
|
|
169
|
+
|
|
170
|
+
1. Write a loop HIL file aggregating all items:
|
|
171
|
+
```bash
|
|
172
|
+
HIL_FILE=".monomind/loops/${LOOP_ID}-hil.md"
|
|
173
|
+
cat > "$HIL_FILE" << EOF
|
|
174
|
+
# Human-in-Loop — /<command> run <current_rep>/<repeat_count>
|
|
175
|
+
Loop: ${LOOP_ID}
|
|
176
|
+
Created: $(date -u +"%Y-%m-%d %H:%M UTC")
|
|
177
|
+
Status: pending
|
|
178
|
+
|
|
179
|
+
The following files contain items requiring human decisions before the loop continues:
|
|
180
|
+
|
|
181
|
+
$(echo "$RECENT_HIL" | while IFS= read -r f; do [ -n "$f" ] && echo "- \`$f\`"; done)
|
|
182
|
+
|
|
183
|
+
## Instructions
|
|
184
|
+
|
|
185
|
+
1. Open each file listed above and fill in **Your response** for each item.
|
|
186
|
+
2. Any non-empty response after a `> ` line is treated as "answered".
|
|
187
|
+
3. Once you have filled in at least one response, the loop will auto-resume on the next check.
|
|
188
|
+
|
|
189
|
+
**Your answer (fill in to resume):**
|
|
190
|
+
>
|
|
191
|
+
EOF
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
2. Update state file:
|
|
195
|
+
```bash
|
|
196
|
+
python3 -c "import json; f='.monomind/loops/${LOOP_ID}.json'; d=json.load(open(f)); d['status']='hil:pending'; open(f,'w').write(json.dumps(d,indent=2))" 2>/dev/null \
|
|
197
|
+
|| jq '.status="hil:pending"' ".monomind/loops/${LOOP_ID}.json" > ".monomind/loops/${LOOP_ID}.json.tmp" && mv ".monomind/loops/${LOOP_ID}.json.tmp" ".monomind/loops/${LOOP_ID}.json" 2>/dev/null || true
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
3. Emit `loop:hil` to dashboard:
|
|
201
|
+
```bash
|
|
202
|
+
curl -s -X POST "http://localhost:4242/api/mastermind/event" \
|
|
203
|
+
-H "Content-Type: application/json" \
|
|
204
|
+
-d "{\"type\":\"loop:hil\",\"loopId\":\"${LOOP_ID}\",\"command\":\"/<command>\",\"hilFile\":\"${HIL_FILE}\",\"rep\":<current_rep>,\"files\":$(echo "$RECENT_HIL" | grep -v '^$' | jq -R . | jq -cs .),\"ts\":$(date +%s)000}" || true
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
4. Output:
|
|
208
|
+
```
|
|
209
|
+
[repeat] Human-in-loop items detected from run <current_rep>/<repeat_count>.
|
|
210
|
+
Action required: open the files listed in ${HIL_FILE} and fill in responses.
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
5. Compute `next_rep = current_rep + 1`. Then branch on whether this was the last run:
|
|
214
|
+
|
|
215
|
+
**If `current_rep >= repeat_count`** (HIL detected on the final run — do not schedule another execution):
|
|
216
|
+
- Output: `[repeat] All <repeat_count> runs of /<command> complete (HIL items pending in ${HIL_FILE}).`
|
|
217
|
+
- Emit `loop:complete`:
|
|
218
|
+
```bash
|
|
219
|
+
curl -s -X POST "http://localhost:4242/api/mastermind/event" \
|
|
220
|
+
-H "Content-Type: application/json" \
|
|
221
|
+
-d "{\"type\":\"loop:complete\",\"loopId\":\"${LOOP_ID}\",\"command\":\"/<command>\",\"ranReps\":<repeat_count>,\"hilPending\":true,\"ts\":$(date +%s)000}" || true
|
|
222
|
+
```
|
|
223
|
+
- `rm -f ".monomind/loops/${LOOP_ID}.json"`
|
|
224
|
+
- STOP. (HIL file remains for human review; loop is done.)
|
|
225
|
+
|
|
226
|
+
**Otherwise** (HIL on an intermediate run — schedule a poll check):
|
|
227
|
+
- Output: `Loop will resume automatically at run <next_rep>/<repeat_count> once responses are provided.`
|
|
228
|
+
- `delaySeconds`: `min(wait_seconds, 300)` — re-check every 5 min max while waiting
|
|
229
|
+
- `prompt`: `/<command> --repeat <repeat_count> --wait <wait_seconds> --rep <next_rep> --loop ${LOOP_ID} <original flags and prompt>`
|
|
230
|
+
- `reason`: `"HIL pending for /<command> run <current_rep>/<repeat_count> — waiting for human response"`
|
|
231
|
+
- Schedule via `ScheduleWakeup` and STOP. Do not proceed to "Schedule next run" below.
|
|
232
|
+
|
|
233
|
+
**If `RECENT_HIL` is empty:** proceed to step 4 (schedule next run normally).
|
|
234
|
+
|
|
235
|
+
### 4. If all runs done (`current_rep ≥ repeat_count`)
|
|
236
|
+
|
|
237
|
+
- Output: `[repeat] All <repeat_count> runs of /<command> complete.`
|
|
238
|
+
- `rm -f ".monomind/loops/${LOOP_ID}.json"`
|
|
239
|
+
- Emit `loop:complete`:
|
|
240
|
+
```bash
|
|
241
|
+
curl -s -X POST "http://localhost:4242/api/mastermind/event" \
|
|
242
|
+
-H "Content-Type: application/json" \
|
|
243
|
+
-d "{\"type\":\"loop:complete\",\"loopId\":\"${LOOP_ID}\",\"command\":\"/<command>\",\"ranReps\":<repeat_count>,\"ts\":$(date +%s)000}" || true
|
|
244
|
+
```
|
|
245
|
+
- STOP (do not schedule another run).
|
|
246
|
+
|
|
247
|
+
### 5. Schedule next run
|
|
248
|
+
|
|
249
|
+
Set `next_rep` = current_rep + 1.
|
|
250
|
+
|
|
251
|
+
Update state file (read `prompt` and `startedAt` from the existing file to preserve them):
|
|
252
|
+
```bash
|
|
253
|
+
# Portable millisecond timestamp (BSD date has no %N; GNU date has %3N)
|
|
254
|
+
NOW_MS=$(python3 -c 'import time;print(int(time.time()*1000))' 2>/dev/null || echo "$(date +%s)000")
|
|
255
|
+
NEXT_AT=$(( NOW_MS + <wait_seconds> * 1000 ))
|
|
256
|
+
INTERVAL_MIN=$(( (<wait_seconds> + 30) / 60 ))
|
|
257
|
+
PROMPT_JSON=$(jq '.prompt' ".monomind/loops/${LOOP_ID}.json" 2>/dev/null \
|
|
258
|
+
|| python3 -c "import json,sys; json.dump(json.load(open('.monomind/loops/${LOOP_ID}.json'))['prompt'], sys.stdout)" 2>/dev/null \
|
|
259
|
+
|| echo '"<prompt>"')
|
|
260
|
+
STARTED_AT=$(jq '.startedAt' ".monomind/loops/${LOOP_ID}.json" 2>/dev/null \
|
|
261
|
+
|| python3 -c "import json; print(json.load(open('.monomind/loops/${LOOP_ID}.json'))['startedAt'])" 2>/dev/null \
|
|
262
|
+
|| echo "${NOW_MS}")
|
|
263
|
+
cat > ".monomind/loops/${LOOP_ID}.json" << EOF
|
|
264
|
+
{
|
|
265
|
+
"id": "${LOOP_ID}",
|
|
266
|
+
"sessionId": "${LOOP_ID}",
|
|
267
|
+
"type": "repeat",
|
|
268
|
+
"command": "/<command>",
|
|
269
|
+
"prompt": ${PROMPT_JSON},
|
|
270
|
+
"maxReps": <repeat_count>,
|
|
271
|
+
"interval": ${INTERVAL_MIN},
|
|
272
|
+
"wait": <wait_seconds>,
|
|
273
|
+
"currentRep": <next_rep>,
|
|
274
|
+
"startedAt": ${STARTED_AT},
|
|
275
|
+
"lastRunAt": ${NOW_MS},
|
|
276
|
+
"nextRunAt": ${NEXT_AT},
|
|
277
|
+
"status": "running",
|
|
278
|
+
"source": "_repeat.md"
|
|
279
|
+
}
|
|
280
|
+
EOF
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
Emit `loop:tick`:
|
|
284
|
+
```bash
|
|
285
|
+
curl -s -X POST "http://localhost:4242/api/mastermind/event" \
|
|
286
|
+
-H "Content-Type: application/json" \
|
|
287
|
+
-d "{\"type\":\"loop:tick\",\"loopId\":\"${LOOP_ID}\",\"command\":\"/<command>\",\"completedRep\":<current_rep>,\"nextRep\":<next_rep>,\"nextAt\":${NEXT_AT},\"ts\":$(date +%s)000}" || true
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
Output: `[repeat] Next run in <wait_seconds>s (run <next_rep>/<repeat_count>)...`
|
|
291
|
+
|
|
292
|
+
Call `ScheduleWakeup`:
|
|
293
|
+
- `delaySeconds`: `<wait_seconds>` (runtime clamps to minimum 60)
|
|
294
|
+
- `prompt`: `/<command> --repeat <repeat_count> --wait <wait_seconds> --rep <next_rep> --loop ${LOOP_ID} <all original flags and prompt text, minus --rep and --loop>`
|
|
295
|
+
- `reason`: `"repeat run <next_rep>/<repeat_count> of /<command>"`
|
|
296
|
+
|
|
297
|
+
---
|
|
298
|
+
|
|
299
|
+
## Notes for Calling Commands
|
|
300
|
+
|
|
301
|
+
- **`<command_slug>`**: lowercase command name without namespace (`build` for `/mastermind:build`, `monomind-idea` for `/monomind:idea`)
|
|
302
|
+
- **Dashboard**: the monomind panel reads `.monomind/loops/*.json` to show active repeat loops; HIL status shows as `"hil:pending"` in the status field
|
|
303
|
+
- **Stopping a loop**: create `.monomind/loops/${LOOP_ID}.stop` or delete the `.json` file; the next wake-up detects it
|
|
304
|
+
- **`wait_seconds` < 60**: ScheduleWakeup clamps to 60; the state file may reflect the user's requested value
|
|
305
|
+
- **Continuation runs skip intake**: calling commands check `is_continuation` and bypass empty-prompt checks and vague-prompt intake
|
|
306
|
+
- **HIL file naming**: commands write `humaninloop*.md` or `humaninloopreview*.md`; the repeat protocol detects these automatically via `find` — no changes needed in individual commands
|
|
307
|
+
- **HIL resume**: the human fills in any `> ` answer line in the HIL files; the next check detects this via `grep -cE "^[[:space:]]*>[[:space:]]+[^[:space:]]"` and resumes the loop
|
|
308
|
+
- **HIL check interval**: while HIL is pending, ScheduleWakeup fires every `min(wait_seconds, 300)` seconds to poll; this is transparent to the user
|