@monoes/monomindcli 2.10.4 → 2.10.6
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/helpers/handlers/gates-handler.cjs +47 -14
- package/.claude/settings.json +1 -1
- package/.claude/skills/mastermind/SKILL.md +15 -0
- package/.claude/skills/mastermind/references/antigravity-tools.md +62 -0
- package/.claude/skills/mastermind/references/claude-code-tools.md +52 -0
- package/.claude/skills/mastermind/references/codex-tools.md +66 -0
- package/.claude/skills/mastermind/references/copilot-tools.md +51 -0
- package/.claude/skills/mastermind/references/gemini-tools.md +65 -0
- package/.claude/skills/mastermind/references/pi-tools.md +30 -0
- package/.claude/skills/mastermind-createorg/SKILL.md +11 -3
- package/.claude/skills/mastermind-debug/SKILL.md +274 -0
- package/.claude/skills/mastermind-execute/SKILL.md +99 -0
- package/.claude/skills/mastermind-memory/SKILL.md +316 -0
- package/.claude/skills/mastermind-org/SKILL.md +13 -0
- package/.claude/skills/mastermind-plan/SKILL.md +212 -0
- package/.claude/skills/mastermind-research/SKILL.md +163 -0
- package/.claude/skills/mastermind-review/SKILL.md +228 -0
- package/.claude/skills/monodesign/scripts/detector/engines/browser/drivers.mjs +33 -0
- package/dist/src/commands/agent-exec.d.ts.map +1 -1
- package/dist/src/commands/agent-exec.js +52 -13
- package/dist/src/commands/agent-exec.js.map +1 -1
- package/dist/src/commands/doctor-project-checks.d.ts.map +1 -1
- package/dist/src/commands/doctor-project-checks.js.map +1 -1
- package/dist/src/commands/org-observe.d.ts.map +1 -1
- package/dist/src/commands/org-observe.js +34 -8
- package/dist/src/commands/org-observe.js.map +1 -1
- package/dist/src/commands/org.d.ts.map +1 -1
- package/dist/src/commands/org.js +10 -5
- package/dist/src/commands/org.js.map +1 -1
- package/dist/src/commands/security-scan.d.ts +64 -1
- package/dist/src/commands/security-scan.d.ts.map +1 -1
- package/dist/src/commands/security-scan.js +75 -2
- package/dist/src/commands/security-scan.js.map +1 -1
- package/dist/src/init/mcp-generator.d.ts.map +1 -1
- package/dist/src/init/mcp-generator.js.map +1 -1
- package/dist/src/orgrt/agent-exec.d.ts +1 -1
- package/dist/src/orgrt/agent-exec.d.ts.map +1 -1
- package/dist/src/orgrt/agent-exec.js +64 -6
- package/dist/src/orgrt/agent-exec.js.map +1 -1
- package/dist/src/orgrt/agent-runner.d.ts.map +1 -1
- package/dist/src/orgrt/agent-runner.js +29 -1
- package/dist/src/orgrt/agent-runner.js.map +1 -1
- package/dist/src/orgrt/kimicode-runner.d.ts.map +1 -1
- package/dist/src/orgrt/kimicode-runner.js.map +1 -1
- package/dist/src/orgrt/org-design-skill.d.ts +9 -0
- package/dist/src/orgrt/org-design-skill.d.ts.map +1 -0
- package/dist/src/orgrt/org-design-skill.js +61 -0
- package/dist/src/orgrt/org-design-skill.js.map +1 -0
- package/dist/src/orgrt/role-skills/account-strategist.md +26 -0
- package/dist/src/orgrt/role-skills/accounts-payable.md +26 -0
- package/dist/src/orgrt/role-skills/adaptive-coordinator.md +26 -0
- package/dist/src/orgrt/role-skills/adaptive-coordinator2.md +25 -0
- package/dist/src/orgrt/role-skills/ai-citation.md +25 -0
- package/dist/src/orgrt/role-skills/ai-engineer.md +28 -0
- package/dist/src/orgrt/role-skills/analytics-reporter.md +27 -0
- package/dist/src/orgrt/role-skills/api-tester.md +27 -0
- package/dist/src/orgrt/role-skills/automation-governance.md +26 -0
- package/dist/src/orgrt/role-skills/backend-dev.md +27 -0
- package/dist/src/orgrt/role-skills/benchmarker.md +28 -0
- package/dist/src/orgrt/role-skills/blockchain-auditor.md +27 -0
- package/dist/src/orgrt/role-skills/byzantine-coord.md +25 -0
- package/dist/src/orgrt/role-skills/case-analyst.md +25 -0
- package/dist/src/orgrt/role-skills/cicd-engineer.md +28 -0
- package/dist/src/orgrt/role-skills/cloud-architect.md +25 -0
- package/dist/src/orgrt/role-skills/code-review-swarm.md +26 -0
- package/dist/src/orgrt/role-skills/coder.md +27 -0
- package/dist/src/orgrt/role-skills/collective-coord.md +25 -0
- package/dist/src/orgrt/role-skills/compliance-auditor.md +27 -0
- package/dist/src/orgrt/role-skills/consensus-coordinator.md +25 -0
- package/dist/src/orgrt/role-skills/content-creator.md +25 -0
- package/dist/src/orgrt/role-skills/cro-specialist.md +26 -0
- package/dist/src/orgrt/role-skills/data-consolidator.md +27 -0
- package/dist/src/orgrt/role-skills/data-engineer.md +27 -0
- package/dist/src/orgrt/role-skills/database-optimizer.md +25 -0
- package/dist/src/orgrt/role-skills/deal-strategist.md +26 -0
- package/dist/src/orgrt/role-skills/defender.md +25 -0
- package/dist/src/orgrt/role-skills/devops-automator.md +25 -0
- package/dist/src/orgrt/role-skills/discovery-coach.md +26 -0
- package/dist/src/orgrt/role-skills/email-marketing.md +27 -0
- package/dist/src/orgrt/role-skills/embedded-firmware.md +25 -0
- package/dist/src/orgrt/role-skills/evidence-collector.md +27 -0
- package/dist/src/orgrt/role-skills/experiment-tracker.md +28 -0
- package/dist/src/orgrt/role-skills/feedback-synthesizer.md +26 -0
- package/dist/src/orgrt/role-skills/finance-tracker.md +26 -0
- package/dist/src/orgrt/role-skills/frontend-developer.md +25 -0
- package/dist/src/orgrt/role-skills/game-audio-engineer.md +26 -0
- package/dist/src/orgrt/role-skills/game-designer.md +26 -0
- package/dist/src/orgrt/role-skills/hierarchical-coord.md +26 -0
- package/dist/src/orgrt/role-skills/incident-commander.md +26 -0
- package/dist/src/orgrt/role-skills/infrastructure.md +25 -0
- package/dist/src/orgrt/role-skills/input-validator.md +27 -0
- package/dist/src/orgrt/role-skills/ios-developer.md +25 -0
- package/dist/src/orgrt/role-skills/issue-tracker.md +26 -0
- package/dist/src/orgrt/role-skills/judge.md +25 -0
- package/dist/src/orgrt/role-skills/launch-strategist.md +25 -0
- package/dist/src/orgrt/role-skills/legal-compliance.md +25 -0
- package/dist/src/orgrt/role-skills/level-designer.md +26 -0
- package/dist/src/orgrt/role-skills/load-balancer.md +28 -0
- package/dist/src/orgrt/role-skills/mcp-builder.md +27 -0
- package/dist/src/orgrt/role-skills/memory-coordinator.md +28 -0
- package/dist/src/orgrt/role-skills/mesh-coordinator.md +26 -0
- package/dist/src/orgrt/role-skills/ml-developer.md +28 -0
- package/dist/src/orgrt/role-skills/mobile-app-builder.md +25 -0
- package/dist/src/orgrt/role-skills/mobile-dev.md +25 -0
- package/dist/src/orgrt/role-skills/model-qa.md +28 -0
- package/dist/src/orgrt/role-skills/narrative-designer.md +26 -0
- package/dist/src/orgrt/role-skills/outbound-strategist.md +26 -0
- package/dist/src/orgrt/role-skills/path-validator.md +27 -0
- package/dist/src/orgrt/role-skills/payment-agent.md +26 -0
- package/dist/src/orgrt/role-skills/perf-analyzer.md +28 -0
- package/dist/src/orgrt/role-skills/pipeline-analyst.md +26 -0
- package/dist/src/orgrt/role-skills/planner.md +27 -0
- package/dist/src/orgrt/role-skills/pr-manager.md +26 -0
- package/dist/src/orgrt/role-skills/pricing-strategist.md +25 -0
- package/dist/src/orgrt/role-skills/product-manager.md +26 -0
- package/dist/src/orgrt/role-skills/production-validator.md +27 -0
- package/dist/src/orgrt/role-skills/project-shepherd.md +25 -0
- package/dist/src/orgrt/role-skills/proposal-strategist.md +26 -0
- package/dist/src/orgrt/role-skills/prosecutor.md +25 -0
- package/dist/src/orgrt/role-skills/queen-coordinator.md +25 -0
- package/dist/src/orgrt/role-skills/quorum-manager.md +25 -0
- package/dist/src/orgrt/role-skills/raft-manager.md +25 -0
- package/dist/src/orgrt/role-skills/reality-checker.md +27 -0
- package/dist/src/orgrt/role-skills/recruitment.md +25 -0
- package/dist/src/orgrt/role-skills/release-manager.md +26 -0
- package/dist/src/orgrt/role-skills/repo-architect.md +25 -0
- package/dist/src/orgrt/role-skills/researcher.md +27 -0
- package/dist/src/orgrt/role-skills/resource-allocator.md +28 -0
- package/dist/src/orgrt/role-skills/reviewer.md +27 -0
- package/dist/src/orgrt/role-skills/safe-executor.md +27 -0
- package/dist/src/orgrt/role-skills/sales-coach.md +26 -0
- package/dist/src/orgrt/role-skills/sales-engineer.md +26 -0
- package/dist/src/orgrt/role-skills/scout-explorer.md +25 -0
- package/dist/src/orgrt/role-skills/security-architect.md +27 -0
- package/dist/src/orgrt/role-skills/security-auditor.md +27 -0
- package/dist/src/orgrt/role-skills/senior-developer.md +27 -0
- package/dist/src/orgrt/role-skills/senior-pm.md +25 -0
- package/dist/src/orgrt/role-skills/seo-specialist.md +25 -0
- package/dist/src/orgrt/role-skills/social-media.md +25 -0
- package/dist/src/orgrt/role-skills/solidity-engineer.md +28 -0
- package/dist/src/orgrt/role-skills/sprint-prioritizer.md +26 -0
- package/dist/src/orgrt/role-skills/sre.md +26 -0
- package/dist/src/orgrt/role-skills/studio-operations.md +25 -0
- package/dist/src/orgrt/role-skills/studio-producer.md +25 -0
- package/dist/src/orgrt/role-skills/support-responder.md +25 -0
- package/dist/src/orgrt/role-skills/system-architect.md +27 -0
- package/dist/src/orgrt/role-skills/task-orchestrator.md +28 -0
- package/dist/src/orgrt/role-skills/technical-artist.md +26 -0
- package/dist/src/orgrt/role-skills/technical-writer.md +27 -0
- package/dist/src/orgrt/role-skills/tester.md +27 -0
- package/dist/src/orgrt/role-skills/threat-detection.md +27 -0
- package/dist/src/orgrt/role-skills/trend-researcher.md +28 -0
- package/dist/src/orgrt/role-skills/trial-director.md +25 -0
- package/dist/src/orgrt/role-skills/unity-architect.md +26 -0
- package/dist/src/orgrt/role-skills/visionos-engineer.md +25 -0
- package/dist/src/orgrt/role-skills/worker-specialist.md +25 -0
- package/dist/src/orgrt/role-skills/workflow-architect.md +25 -0
- package/dist/src/orgrt/role-skills/workflow-automation.md +26 -0
- package/dist/src/orgrt/role-skills/zk-steward.md +27 -0
- package/dist/src/orgrt/role-skills.d.ts +9 -0
- package/dist/src/orgrt/role-skills.d.ts.map +1 -0
- package/dist/src/orgrt/role-skills.js +52 -0
- package/dist/src/orgrt/role-skills.js.map +1 -0
- package/dist/src/orgrt/runner-registry.d.ts.map +1 -1
- package/dist/src/orgrt/runner-registry.js +7 -3
- package/dist/src/orgrt/runner-registry.js.map +1 -1
- package/dist/src/orgrt/session.d.ts +16 -2
- package/dist/src/orgrt/session.d.ts.map +1 -1
- package/dist/src/orgrt/session.js +36 -3
- package/dist/src/orgrt/session.js.map +1 -1
- package/dist/src/orgrt/types.d.ts +12 -0
- package/dist/src/orgrt/types.d.ts.map +1 -1
- package/dist/src/orgrt/types.js +15 -0
- package/dist/src/orgrt/types.js.map +1 -1
- package/dist/src/ui/dashboard.html +15 -225
- package/dist/src/ui/data/mastermind-sessions.json +1 -0
- package/dist/src/ui/routes-monoes.mjs +7 -3
- package/dist/src/ui/routes-org.mjs +1 -68
- package/dist/src/ui/server.mjs +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
|
@@ -275,3 +275,277 @@ Systematic approach vs random fixing:
|
|
|
275
275
|
- Time to fix: 15-30 min vs 2-3 hours of thrashing
|
|
276
276
|
- First-time fix rate: ~95% vs ~40%
|
|
277
277
|
- New bugs introduced by the fix: near zero vs common
|
|
278
|
+
# monomind:start skills:claude:mastermind-debug
|
|
279
|
+
# mastermind:debug — Systematic Debugging
|
|
280
|
+
|
|
281
|
+
## Overview
|
|
282
|
+
|
|
283
|
+
Random fixes waste time and create new bugs. Quick patches mask underlying issues.
|
|
284
|
+
|
|
285
|
+
**Core principle:** ALWAYS find root cause before attempting fixes. Symptom fixes are failure.
|
|
286
|
+
|
|
287
|
+
**Violating the letter of this process is violating the spirit of debugging.**
|
|
288
|
+
|
|
289
|
+
## The Iron Law
|
|
290
|
+
|
|
291
|
+
```
|
|
292
|
+
NO FIXES WITHOUT ROOT CAUSE INVESTIGATION FIRST
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
If you haven't completed Phase 1, you cannot propose fixes.
|
|
296
|
+
|
|
297
|
+
## When to Use
|
|
298
|
+
|
|
299
|
+
Use for ANY technical issue:
|
|
300
|
+
- Test failures
|
|
301
|
+
- Bugs in production or staging
|
|
302
|
+
- Unexpected behavior
|
|
303
|
+
- Performance regressions
|
|
304
|
+
- Build failures
|
|
305
|
+
- Integration issues
|
|
306
|
+
|
|
307
|
+
**Use this ESPECIALLY when:**
|
|
308
|
+
- Under time pressure (emergencies make guessing tempting)
|
|
309
|
+
- "Just one quick fix" seems obvious
|
|
310
|
+
- You've already tried multiple fixes that didn't work
|
|
311
|
+
- Previous fix didn't resolve the issue
|
|
312
|
+
- You don't fully understand what's happening
|
|
313
|
+
|
|
314
|
+
**Don't skip when:**
|
|
315
|
+
- Issue seems simple (simple bugs have root causes too)
|
|
316
|
+
- You're in a hurry (systematic is faster than thrashing)
|
|
317
|
+
- The user wants it fixed immediately (systematic approach finds the real fix faster)
|
|
318
|
+
|
|
319
|
+
## The Four Phases
|
|
320
|
+
|
|
321
|
+
You MUST complete each phase before proceeding to the next.
|
|
322
|
+
|
|
323
|
+
---
|
|
324
|
+
|
|
325
|
+
### Phase 1: Root Cause Investigation
|
|
326
|
+
|
|
327
|
+
**BEFORE attempting ANY fix:**
|
|
328
|
+
|
|
329
|
+
1. **Read Error Messages Carefully**
|
|
330
|
+
- Don't skim errors or warnings
|
|
331
|
+
- They often contain the exact solution
|
|
332
|
+
- Read stack traces completely
|
|
333
|
+
- Note line numbers, file paths, error codes
|
|
334
|
+
|
|
335
|
+
2. **Reproduce Consistently**
|
|
336
|
+
- Can you trigger the issue reliably?
|
|
337
|
+
- What are the exact steps?
|
|
338
|
+
- Does it happen every time?
|
|
339
|
+
- If not reproducible → gather more data, don't guess
|
|
340
|
+
|
|
341
|
+
3. **Check Recent Changes**
|
|
342
|
+
- What changed that could cause this?
|
|
343
|
+
- `git diff`, recent commits, new dependencies, config changes
|
|
344
|
+
- Environmental differences between working and broken states
|
|
345
|
+
|
|
346
|
+
4. **Gather Evidence in Multi-Component Systems**
|
|
347
|
+
|
|
348
|
+
**WHEN the system has multiple components (CI → build → deploy, API → service → database):**
|
|
349
|
+
|
|
350
|
+
**BEFORE proposing fixes, add diagnostic instrumentation:**
|
|
351
|
+
```
|
|
352
|
+
For EACH component boundary:
|
|
353
|
+
- Log what data enters the component
|
|
354
|
+
- Log what data exits the component
|
|
355
|
+
- Verify config/env propagation at each layer
|
|
356
|
+
- Check state at each boundary
|
|
357
|
+
|
|
358
|
+
Run once to gather evidence showing WHERE it breaks
|
|
359
|
+
THEN analyze evidence to identify the failing component
|
|
360
|
+
THEN investigate that specific component
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
**Example:**
|
|
364
|
+
```bash
|
|
365
|
+
# Layer 1: entry point
|
|
366
|
+
echo "=== Input received: ==="
|
|
367
|
+
echo "VAR: ${VAR:+SET}${VAR:-UNSET}"
|
|
368
|
+
|
|
369
|
+
# Layer 2: processing
|
|
370
|
+
echo "=== State after processing: ==="
|
|
371
|
+
env | grep VAR || echo "VAR not in environment"
|
|
372
|
+
|
|
373
|
+
# Layer 3: output/result
|
|
374
|
+
echo "=== Final state: ==="
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
5. **Trace Data Flow**
|
|
378
|
+
|
|
379
|
+
**WHEN the error is deep in a call stack:**
|
|
380
|
+
- Where does the bad value originate?
|
|
381
|
+
- What called this with the bad value?
|
|
382
|
+
- Keep tracing up until you find the source
|
|
383
|
+
- Fix at the source, not at the symptom — a `null` crashing in layer 4 usually entered in layer 1
|
|
384
|
+
|
|
385
|
+
---
|
|
386
|
+
|
|
387
|
+
### Phase 2: Pattern Analysis
|
|
388
|
+
|
|
389
|
+
Once you understand WHERE the break is, find existing working examples:
|
|
390
|
+
|
|
391
|
+
1. **Find working code that solves the same problem**
|
|
392
|
+
- Search the codebase for similar patterns
|
|
393
|
+
- Check git history for when this worked
|
|
394
|
+
- Find the canonical implementation to compare against
|
|
395
|
+
|
|
396
|
+
2. **Compare against references**
|
|
397
|
+
- If implementing a pattern, read the reference implementation COMPLETELY
|
|
398
|
+
- Don't skim — read every line
|
|
399
|
+
- Understand the pattern fully before applying it
|
|
400
|
+
|
|
401
|
+
3. **Compare broken vs. working**
|
|
402
|
+
- What's different?
|
|
403
|
+
- List every difference, not just the obvious one — don't assume "that can't matter"
|
|
404
|
+
- Environment, config, data, timing
|
|
405
|
+
|
|
406
|
+
4. **Understand dependencies**
|
|
407
|
+
- What other components does this need?
|
|
408
|
+
- What settings, config, environment?
|
|
409
|
+
- What assumptions does it make?
|
|
410
|
+
|
|
411
|
+
---
|
|
412
|
+
|
|
413
|
+
### Phase 3: Form and Test a Hypothesis
|
|
414
|
+
|
|
415
|
+
1. **State your hypothesis explicitly:**
|
|
416
|
+
> "I believe the root cause is [X] because [evidence Y] and [evidence Z]."
|
|
417
|
+
|
|
418
|
+
2. **Test the hypothesis minimally**
|
|
419
|
+
- Change one thing and observe the result
|
|
420
|
+
- If it doesn't confirm or deny, gather more evidence
|
|
421
|
+
- A confirmed hypothesis means you understand the root cause
|
|
422
|
+
|
|
423
|
+
3. **If hypothesis is wrong:** Do NOT add more fixes. Return to Phase 1 with the new information.
|
|
424
|
+
|
|
425
|
+
4. **When you don't know:** Say "I don't understand X". Don't pretend to know. Research more or ask the user — a stated unknown beats a confident guess.
|
|
426
|
+
|
|
427
|
+
---
|
|
428
|
+
|
|
429
|
+
### Phase 4: Implementation
|
|
430
|
+
|
|
431
|
+
1. **Write a failing test first** (before touching production code)
|
|
432
|
+
- Automated test where possible; a one-off test script if no framework
|
|
433
|
+
- Use `Skill("mastermind-tdd")` for writing proper failing tests
|
|
434
|
+
- The test MUST fail before the fix proves it
|
|
435
|
+
|
|
436
|
+
2. **Implement a single fix**
|
|
437
|
+
- Address the root cause identified in Phase 3
|
|
438
|
+
- ONE change at a time
|
|
439
|
+
- No "while I'm here" improvements
|
|
440
|
+
- No bundled refactoring
|
|
441
|
+
|
|
442
|
+
3. **Verify the fix**
|
|
443
|
+
- Test passes now?
|
|
444
|
+
- No other tests broken?
|
|
445
|
+
- Issue actually resolved?
|
|
446
|
+
- Use `Skill("mastermind-review")` to verify before declaring done
|
|
447
|
+
|
|
448
|
+
4. **If the fix doesn't work:**
|
|
449
|
+
- STOP
|
|
450
|
+
- Count: How many fixes have you tried?
|
|
451
|
+
- If < 3: Return to Phase 1, re-analyze with the new information
|
|
452
|
+
- **If ≥ 3: STOP — this is likely an architectural problem (see Phase 4.5 below)**
|
|
453
|
+
- Do NOT attempt a 4th fix without architectural discussion
|
|
454
|
+
|
|
455
|
+
---
|
|
456
|
+
|
|
457
|
+
### Phase 4.5 — If 3+ Fixes Have Failed: Question the Architecture
|
|
458
|
+
|
|
459
|
+
**Pattern indicating an architectural problem:**
|
|
460
|
+
- Each fix reveals new coupling or shared state issues in a different place
|
|
461
|
+
- Each fix creates new symptoms elsewhere
|
|
462
|
+
- Fixes require "massive refactoring" to implement cleanly
|
|
463
|
+
|
|
464
|
+
**STOP and question fundamentals:**
|
|
465
|
+
- Is this design pattern fundamentally sound?
|
|
466
|
+
- Are we continuing out of inertia?
|
|
467
|
+
- Should we refactor the architecture rather than continue patching?
|
|
468
|
+
|
|
469
|
+
**Discuss with the user before attempting more fixes.** This is not a failed hypothesis — this is the wrong architecture.
|
|
470
|
+
|
|
471
|
+
---
|
|
472
|
+
|
|
473
|
+
## Red Flags — STOP and Return to Phase 1
|
|
474
|
+
|
|
475
|
+
If you catch yourself thinking or doing any of these:
|
|
476
|
+
|
|
477
|
+
| Thought / Action | What it means |
|
|
478
|
+
|---|---|
|
|
479
|
+
| "Quick fix for now, investigate later" | You're skipping root cause. Return to Phase 1. |
|
|
480
|
+
| "Just try changing X and see if it works" | Guessing. Return to Phase 1. |
|
|
481
|
+
| "Add multiple changes, run tests" | Can't isolate what worked. Return to Phase 1. |
|
|
482
|
+
| "Skip the test, I'll manually verify" | Untested fixes don't stick. Write the failing test. |
|
|
483
|
+
| "Pattern says X but I'll adapt it differently" | Partial understanding guarantees bugs. Read the reference completely. |
|
|
484
|
+
| "Here are the main problems: …" (listing fixes without investigation) | Solutions before evidence. Return to Phase 1. |
|
|
485
|
+
| "It's probably X, let me fix that" | Assumed root cause. Verify it first. Return to Phase 1. |
|
|
486
|
+
| "I don't fully understand but this might work" | You don't have a hypothesis. Return to Phase 1. |
|
|
487
|
+
| Proposing solutions before tracing data flow | No root cause. Return to Phase 1. |
|
|
488
|
+
| "One more fix attempt" (already tried 2+) | 3+ failures = architectural problem. Phase 4.5. |
|
|
489
|
+
| Each fix reveals a new problem in a different place | Architectural problem. Phase 4.5. |
|
|
490
|
+
|
|
491
|
+
## User Signals You're Doing It Wrong
|
|
492
|
+
|
|
493
|
+
Watch for these redirections from the user:
|
|
494
|
+
|
|
495
|
+
| Signal | What it means |
|
|
496
|
+
|---|---|
|
|
497
|
+
| "Is that actually happening?" | You assumed without verifying. Add evidence gathering. |
|
|
498
|
+
| "What does the output show?" | You should have checked before proposing a fix. |
|
|
499
|
+
| "Stop guessing" | You're proposing fixes without root cause. Phase 1. |
|
|
500
|
+
| "We keep going in circles" | 3+ fix attempts = architectural problem. Phase 4.5. |
|
|
501
|
+
|
|
502
|
+
## Common Rationalizations
|
|
503
|
+
|
|
504
|
+
| Excuse | Reality |
|
|
505
|
+
|---|---|
|
|
506
|
+
| "Issue is simple, don't need process" | Simple issues have root causes too. Process is fast for simple bugs. |
|
|
507
|
+
| "Emergency, no time for process" | Systematic debugging is FASTER than guess-and-check thrashing. |
|
|
508
|
+
| "Just try this first, then investigate" | First fix sets the pattern. Do it right from the start. |
|
|
509
|
+
| "I'll write the test after confirming the fix works" | Untested fixes don't stick. Test first proves it. |
|
|
510
|
+
| "Multiple fixes at once saves time" | Can't isolate what worked. Creates new bugs. |
|
|
511
|
+
| "Reference too long, I'll adapt the pattern" | Partial understanding guarantees bugs. Read it completely. |
|
|
512
|
+
| "I can see the problem, let me fix it" | Seeing symptoms ≠ understanding root cause. |
|
|
513
|
+
| "One more fix attempt" (after 2+ failures) | 3+ failures = architectural problem. Question the pattern. |
|
|
514
|
+
|
|
515
|
+
## Quick Reference
|
|
516
|
+
|
|
517
|
+
| Phase | Key Activities | Success Criteria |
|
|
518
|
+
|---|---|---|
|
|
519
|
+
| **1. Root Cause** | Read errors, reproduce, check changes, gather evidence | Understand WHAT and WHY |
|
|
520
|
+
| **2. Pattern** | Find working examples, compare | Identified differences |
|
|
521
|
+
| **3. Hypothesis** | Form theory, test minimally | Confirmed or new hypothesis |
|
|
522
|
+
| **4. Implementation** | Write failing test, fix, verify | Bug resolved, tests pass |
|
|
523
|
+
|
|
524
|
+
## When the Process Reveals "No Root Cause"
|
|
525
|
+
|
|
526
|
+
If systematic investigation reveals the issue is truly environmental, timing-dependent, or external:
|
|
527
|
+
|
|
528
|
+
1. You've completed the process
|
|
529
|
+
2. Document what you investigated
|
|
530
|
+
3. Implement appropriate handling (retry, timeout, clear error message)
|
|
531
|
+
4. Add monitoring/logging for future investigation
|
|
532
|
+
|
|
533
|
+
**But:** 95% of "no root cause" cases are incomplete investigation.
|
|
534
|
+
|
|
535
|
+
## Supporting Techniques
|
|
536
|
+
|
|
537
|
+
- **Root-cause tracing:** when a bad value crashes deep in the stack, trace it backward caller by caller until you find where it was created; fix there. Adding a guard at the crash site only hides the origin.
|
|
538
|
+
- **Defense in depth:** AFTER fixing the root cause, add validation at the layers the bad value passed through unchecked — so the next bad value fails loudly at its first boundary, not silently at its fourth.
|
|
539
|
+
- **Condition-based waiting:** replace arbitrary sleeps/timeouts in flaky tests and scripts with polling for the actual condition ("wait until the file exists / the port answers"), with a hard cap. Timing guesses are bugs waiting for a slower machine.
|
|
540
|
+
|
|
541
|
+
**Related skills:**
|
|
542
|
+
- `Skill("mastermind-tdd")` — for creating the failing test case (Phase 4, Step 1)
|
|
543
|
+
- `Skill("mastermind-verify")` — verify the fix worked before claiming success
|
|
544
|
+
|
|
545
|
+
## Impact
|
|
546
|
+
|
|
547
|
+
Systematic approach vs random fixing:
|
|
548
|
+
- Time to fix: 15-30 min vs 2-3 hours of thrashing
|
|
549
|
+
- First-time fix rate: ~95% vs ~40%
|
|
550
|
+
- New bugs introduced by the fix: near zero vs common
|
|
551
|
+
# monomind:end skills:claude:mastermind-debug
|
|
@@ -102,3 +102,102 @@ After all tasks complete and are verified:
|
|
|
102
102
|
- `Skill("mastermind-taskdev")` — subagent-driven parallel task execution (preferred for complex plans)
|
|
103
103
|
- `Skill("mastermind-finish")` — complete the development branch after all tasks
|
|
104
104
|
- `Skill("mastermind-verify")` — verification gate before finishing
|
|
105
|
+
# monomind:start skills:claude:mastermind-execute
|
|
106
|
+
# Mastermind Execute
|
|
107
|
+
|
|
108
|
+
Load plan, review critically, execute all tasks, report when complete.
|
|
109
|
+
|
|
110
|
+
**Announce at start:** "I'm using the mastermind:execute skill to implement this plan."
|
|
111
|
+
|
|
112
|
+
**Note:** This skill works best with subagent support (Claude Code). When subagents are available, prefer `Skill("mastermind-taskdev")` for parallel task execution.
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
## Inputs
|
|
117
|
+
|
|
118
|
+
- `brain_context`: BRAIN CONTEXT block (injected by master, or loaded standalone via mastermind-protocol/SKILL.md brain load)
|
|
119
|
+
- `plan_path`: path to the plan file to execute
|
|
120
|
+
- `project_name`: monotask space name
|
|
121
|
+
- `board_id`: monotask board ID
|
|
122
|
+
- `mode`: auto | confirm
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
## The Process
|
|
127
|
+
|
|
128
|
+
### Step 1: Load and Review Plan
|
|
129
|
+
|
|
130
|
+
1. Read the plan file at `plan_path`
|
|
131
|
+
2. Review critically — identify any questions or concerns:
|
|
132
|
+
- Missing dependencies or prerequisites
|
|
133
|
+
- Ambiguous instructions
|
|
134
|
+
- Steps that contradict each other
|
|
135
|
+
- Verifications that cannot be run
|
|
136
|
+
3. If concerns exist: raise them with the user before starting
|
|
137
|
+
4. If no concerns: create a TodoWrite with each task and proceed
|
|
138
|
+
|
|
139
|
+
### Step 2: Execute Tasks
|
|
140
|
+
|
|
141
|
+
For each task in the plan:
|
|
142
|
+
|
|
143
|
+
1. Mark as `in_progress`
|
|
144
|
+
2. Follow each step exactly — the plan has bite-sized steps; do not skip or reorder
|
|
145
|
+
3. Run verifications as specified in the plan
|
|
146
|
+
4. Mark as `completed`
|
|
147
|
+
|
|
148
|
+
When the plan references skills:
|
|
149
|
+
- `mastermind:taskdev` → invoke `Skill("mastermind-taskdev")`
|
|
150
|
+
- `mastermind:verify` → invoke `Skill("mastermind-verify")`
|
|
151
|
+
- Any other `mastermind:*` skill → invoke `Skill("mastermind-<name>")`
|
|
152
|
+
|
|
153
|
+
### Step 3: Complete Development
|
|
154
|
+
|
|
155
|
+
After all tasks complete and are verified:
|
|
156
|
+
|
|
157
|
+
- Announce: "All tasks complete. Handing off to mastermind:finish."
|
|
158
|
+
- **REQUIRED SUB-SKILL:** invoke `Skill("mastermind-finish")`
|
|
159
|
+
- Follow that skill to verify tests, present options, and execute the chosen finish action
|
|
160
|
+
|
|
161
|
+
---
|
|
162
|
+
|
|
163
|
+
## When to Stop and Ask for Help
|
|
164
|
+
|
|
165
|
+
**STOP executing immediately when:**
|
|
166
|
+
- A blocker is encountered (missing dependency, failing test, unclear instruction)
|
|
167
|
+
- The plan has critical gaps preventing a task from starting
|
|
168
|
+
- An instruction cannot be understood without guessing
|
|
169
|
+
- A verification fails repeatedly (more than twice)
|
|
170
|
+
|
|
171
|
+
**Ask for clarification rather than guessing.** Never invent steps not in the plan.
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
## When to Revisit Earlier Steps
|
|
176
|
+
|
|
177
|
+
**Return to Step 1 (Review) when:**
|
|
178
|
+
- The user updates the plan based on feedback
|
|
179
|
+
- A fundamental approach needs rethinking due to new information
|
|
180
|
+
|
|
181
|
+
**Do not force through blockers.** Stop and ask.
|
|
182
|
+
|
|
183
|
+
---
|
|
184
|
+
|
|
185
|
+
## Rules
|
|
186
|
+
|
|
187
|
+
- Review the plan critically before touching any code
|
|
188
|
+
- Follow plan steps exactly — do not improvise
|
|
189
|
+
- Do not skip verifications
|
|
190
|
+
- Reference skills when the plan says to invoke them
|
|
191
|
+
- Stop when blocked; never guess
|
|
192
|
+
- Never start implementation on `main` or `master` without explicit user consent
|
|
193
|
+
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
## Integration
|
|
197
|
+
|
|
198
|
+
**Skills used by this skill:**
|
|
199
|
+
- `Skill("mastermind-plan")` — creates the plan this skill executes
|
|
200
|
+
- `Skill("mastermind-taskdev")` — subagent-driven parallel task execution (preferred for complex plans)
|
|
201
|
+
- `Skill("mastermind-finish")` — complete the development branch after all tasks
|
|
202
|
+
- `Skill("mastermind-verify")` — verification gate before finishing
|
|
203
|
+
# monomind:end skills:claude:mastermind-execute
|
|
@@ -319,3 +319,319 @@ topic: <topic>
|
|
|
319
319
|
## Step 4 — Brain Write (standalone only)
|
|
320
320
|
|
|
321
321
|
If `caller` is not "command", follow mastermind-protocol/SKILL.md Brain Write Procedure for domain `ops`.
|
|
322
|
+
# monomind:start skills:claude:mastermind-memory
|
|
323
|
+
# Mastermind Memory
|
|
324
|
+
|
|
325
|
+
This skill is invoked by `mastermind:memory` or directly via `/mastermind:memory`.
|
|
326
|
+
|
|
327
|
+
---
|
|
328
|
+
|
|
329
|
+
## Inputs
|
|
330
|
+
|
|
331
|
+
- `brain_context`: BRAIN CONTEXT block (injected by command, or loaded below if standalone)
|
|
332
|
+
- `org_name`: org whose memory to operate on (required)
|
|
333
|
+
- `action`: ingest | recall | query | update | forget | synthesize | decay | list
|
|
334
|
+
- `topic`: topic or entity name (required for ingest/recall/update/forget)
|
|
335
|
+
- `layer`: knowledge | daily | tacit (default: knowledge)
|
|
336
|
+
- `category`: projects | areas | resources | archives (for layer=knowledge; default: resources)
|
|
337
|
+
- `content`: fact or note body (required for ingest/update)
|
|
338
|
+
- `caller`: command | master
|
|
339
|
+
|
|
340
|
+
---
|
|
341
|
+
|
|
342
|
+
## Memory Architecture (PARA)
|
|
343
|
+
|
|
344
|
+
Three layers, mirrored to `.monomind/orgs/<org_name>-memory/`:
|
|
345
|
+
|
|
346
|
+
```
|
|
347
|
+
.monomind/orgs/<org>-memory/
|
|
348
|
+
knowledge/ ← Layer 1: PARA knowledge graph
|
|
349
|
+
projects/<topic>/
|
|
350
|
+
summary.md
|
|
351
|
+
items.yaml
|
|
352
|
+
areas/<topic>/
|
|
353
|
+
summary.md
|
|
354
|
+
items.yaml
|
|
355
|
+
resources/<topic>/
|
|
356
|
+
summary.md
|
|
357
|
+
items.yaml
|
|
358
|
+
archives/<topic>/
|
|
359
|
+
summary.md
|
|
360
|
+
items.yaml
|
|
361
|
+
index.md
|
|
362
|
+
daily/ ← Layer 2: Raw timeline (YYYY-MM-DD.md)
|
|
363
|
+
tacit.md ← Layer 3: Org operating patterns
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
**PARA rules:**
|
|
367
|
+
- **projects** — active work with a goal/deadline; archive when complete
|
|
368
|
+
- **areas** — ongoing responsibilities, no end date
|
|
369
|
+
- **resources** — reference material, topics of interest
|
|
370
|
+
- **archives** — inactive items from any category
|
|
371
|
+
|
|
372
|
+
---
|
|
373
|
+
|
|
374
|
+
## Step 0 — Brain Load (standalone only)
|
|
375
|
+
|
|
376
|
+
If `caller` is not "command", load brain context following mastermind-protocol/SKILL.md Brain Load Procedure with namespace: `ops`.
|
|
377
|
+
|
|
378
|
+
---
|
|
379
|
+
|
|
380
|
+
## Step 1 — Resolve Memory Root
|
|
381
|
+
|
|
382
|
+
```bash
|
|
383
|
+
memRoot=".monomind/orgs/${org_name}-memory"
|
|
384
|
+
mkdir -p "$memRoot/knowledge/projects" "$memRoot/knowledge/areas" \
|
|
385
|
+
"$memRoot/knowledge/resources" "$memRoot/knowledge/archives" \
|
|
386
|
+
"$memRoot/daily"
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
---
|
|
390
|
+
|
|
391
|
+
## Step 2 — Execute Action
|
|
392
|
+
|
|
393
|
+
### ingest (default for new facts)
|
|
394
|
+
|
|
395
|
+
Store a durable fact in Layer 1 (knowledge graph) or Layer 2 (daily note).
|
|
396
|
+
|
|
397
|
+
```bash
|
|
398
|
+
ts=$(date -u +%Y-%m-%dT%H:%M:%SZ)
|
|
399
|
+
day=$(date -u +%Y-%m-%d)
|
|
400
|
+
layer="${layer:-knowledge}"
|
|
401
|
+
category="${category:-resources}"
|
|
402
|
+
topicSlug=$(echo "${topic:-general}" | tr '[:upper:]' '[:lower:]' | tr ' ' '-' | tr -cd 'a-z0-9-')
|
|
403
|
+
|
|
404
|
+
if [ "$layer" = "daily" ]; then
|
|
405
|
+
dailyFile="$memRoot/daily/${day}.md"
|
|
406
|
+
[ ! -f "$dailyFile" ] && echo "# Daily Notes — ${day}" > "$dailyFile"
|
|
407
|
+
echo "" >> "$dailyFile"
|
|
408
|
+
echo "## [${ts}] ${topic:-note}" >> "$dailyFile"
|
|
409
|
+
echo "${content}" >> "$dailyFile"
|
|
410
|
+
echo " [daily] Appended to $dailyFile"
|
|
411
|
+
elif [ "$layer" = "tacit" ]; then
|
|
412
|
+
[ ! -f "$memRoot/tacit.md" ] && echo "# Org Operating Patterns — ${org_name}" > "$memRoot/tacit.md"
|
|
413
|
+
echo "" >> "$memRoot/tacit.md"
|
|
414
|
+
echo "## ${topic}" >> "$memRoot/tacit.md"
|
|
415
|
+
echo "${content}" >> "$memRoot/tacit.md"
|
|
416
|
+
echo " [tacit] Pattern saved."
|
|
417
|
+
else
|
|
418
|
+
# Layer 1: knowledge graph
|
|
419
|
+
entityDir="$memRoot/knowledge/${category}/${topicSlug}"
|
|
420
|
+
mkdir -p "$entityDir"
|
|
421
|
+
factId="fact-$(python3 -c 'import time; print(int(time.time()*1000))')"
|
|
422
|
+
python3 - "$entityDir/items.yaml" "$factId" "${topic}" "${content}" "$ts" <<'PYEOF'
|
|
423
|
+
import sys, yaml, os
|
|
424
|
+
path, fid, topic, body, ts = sys.argv[1:]
|
|
425
|
+
facts = []
|
|
426
|
+
if os.path.exists(path):
|
|
427
|
+
try:
|
|
428
|
+
with open(path) as f:
|
|
429
|
+
loaded = yaml.safe_load(f)
|
|
430
|
+
if isinstance(loaded, list): facts = loaded
|
|
431
|
+
except: pass
|
|
432
|
+
facts.append({"id": fid, "topic": topic, "body": body, "createdAt": ts, "status": "active"})
|
|
433
|
+
with open(path, "w") as f:
|
|
434
|
+
yaml.dump(facts, f, default_flow_style=False, allow_unicode=True)
|
|
435
|
+
print(f" Fact saved: {fid} → {path}")
|
|
436
|
+
PYEOF
|
|
437
|
+
fi
|
|
438
|
+
```
|
|
439
|
+
|
|
440
|
+
### recall / query
|
|
441
|
+
|
|
442
|
+
Search org memory across all layers for a topic or keyword.
|
|
443
|
+
|
|
444
|
+
```bash
|
|
445
|
+
q="${topic:-${content}}"
|
|
446
|
+
echo "MEMORY RECALL — ${org_name}"
|
|
447
|
+
echo "Query: $q"
|
|
448
|
+
echo "────────────────────────────────────────────────────────"
|
|
449
|
+
|
|
450
|
+
python3 - "$memRoot" "$q" <<'PYEOF'
|
|
451
|
+
import os, sys, yaml, re
|
|
452
|
+
root, query = sys.argv[1], sys.argv[2].lower()
|
|
453
|
+
results = []
|
|
454
|
+
|
|
455
|
+
# Layer 1: scan items.yaml files
|
|
456
|
+
kg = os.path.join(root, "knowledge")
|
|
457
|
+
for cat in ["projects","areas","resources","archives"]:
|
|
458
|
+
cpath = os.path.join(kg, cat)
|
|
459
|
+
if not os.path.isdir(cpath): continue
|
|
460
|
+
for topic in os.listdir(cpath):
|
|
461
|
+
ypath = os.path.join(cpath, topic, "items.yaml")
|
|
462
|
+
if not os.path.exists(ypath): continue
|
|
463
|
+
try:
|
|
464
|
+
facts = yaml.safe_load(open(ypath)) or []
|
|
465
|
+
for f in facts:
|
|
466
|
+
if f.get("status") == "superseded": continue
|
|
467
|
+
body = str(f.get("body","")).lower()
|
|
468
|
+
ftopic = str(f.get("topic","")).lower()
|
|
469
|
+
if query in body or query in ftopic or query in topic.lower():
|
|
470
|
+
results.append(("knowledge/"+cat+"/"+topic, f.get("createdAt","?")[:10], f.get("body","")[:120]))
|
|
471
|
+
except: pass
|
|
472
|
+
|
|
473
|
+
# Layer 2: daily notes
|
|
474
|
+
daily_dir = os.path.join(root, "daily")
|
|
475
|
+
if os.path.isdir(daily_dir):
|
|
476
|
+
for fname in sorted(os.listdir(daily_dir), reverse=True)[:30]:
|
|
477
|
+
try:
|
|
478
|
+
text = open(os.path.join(daily_dir, fname)).read().lower()
|
|
479
|
+
if query in text:
|
|
480
|
+
results.append(("daily/"+fname, fname[:10], "(match in daily notes)"))
|
|
481
|
+
except: pass
|
|
482
|
+
|
|
483
|
+
# Layer 3: tacit
|
|
484
|
+
tacit = os.path.join(root, "tacit.md")
|
|
485
|
+
if os.path.exists(tacit):
|
|
486
|
+
text = open(tacit).read().lower()
|
|
487
|
+
if query in text:
|
|
488
|
+
results.append(("tacit.md", "", "(match in org patterns)"))
|
|
489
|
+
|
|
490
|
+
if not results:
|
|
491
|
+
print(" No matches found.")
|
|
492
|
+
else:
|
|
493
|
+
print(f" {len(results)} result(s):")
|
|
494
|
+
for path, date, body in results[:20]:
|
|
495
|
+
print(f"\n [{date}] {path}")
|
|
496
|
+
print(f" {body[:100]}{'...' if len(body)>100 else ''}")
|
|
497
|
+
PYEOF
|
|
498
|
+
```
|
|
499
|
+
|
|
500
|
+
### list
|
|
501
|
+
|
|
502
|
+
List all entities in the knowledge graph.
|
|
503
|
+
|
|
504
|
+
```bash
|
|
505
|
+
echo "KNOWLEDGE GRAPH — ${org_name}"
|
|
506
|
+
echo "────────────────────────────────────────────────────────"
|
|
507
|
+
|
|
508
|
+
python3 - "$memRoot/knowledge" <<'PYEOF'
|
|
509
|
+
import os, sys, yaml
|
|
510
|
+
kg = sys.argv[1]
|
|
511
|
+
total = 0
|
|
512
|
+
for cat in ["projects","areas","resources","archives"]:
|
|
513
|
+
cpath = os.path.join(kg, cat)
|
|
514
|
+
if not os.path.isdir(cpath): continue
|
|
515
|
+
topics = [d for d in os.listdir(cpath) if os.path.isdir(os.path.join(cpath,d))]
|
|
516
|
+
if not topics: continue
|
|
517
|
+
print(f"\n {cat.upper()} ({len(topics)})")
|
|
518
|
+
for t in sorted(topics):
|
|
519
|
+
ypath = os.path.join(cpath, t, "items.yaml")
|
|
520
|
+
count = 0
|
|
521
|
+
try:
|
|
522
|
+
facts = yaml.safe_load(open(ypath)) or []
|
|
523
|
+
count = len([f for f in facts if f.get("status") != "superseded"])
|
|
524
|
+
except: pass
|
|
525
|
+
print(f" · {t} ({count} facts)")
|
|
526
|
+
total += len(topics)
|
|
527
|
+
print(f"\n Total entities: {total}")
|
|
528
|
+
PYEOF
|
|
529
|
+
```
|
|
530
|
+
|
|
531
|
+
### forget
|
|
532
|
+
|
|
533
|
+
Mark a fact as superseded (never delete — supersede).
|
|
534
|
+
|
|
535
|
+
```bash
|
|
536
|
+
topicSlug=$(echo "${topic}" | tr '[:upper:]' '[:lower:]' | tr ' ' '-' | tr -cd 'a-z0-9-')
|
|
537
|
+
ts=$(date -u +%Y-%m-%dT%H:%M:%SZ)
|
|
538
|
+
category="${category:-resources}"
|
|
539
|
+
entityDir="$memRoot/knowledge/${category}/${topicSlug}"
|
|
540
|
+
ypath="$entityDir/items.yaml"
|
|
541
|
+
|
|
542
|
+
python3 - "$ypath" "$ts" "${content:-forgot}" <<'PYEOF'
|
|
543
|
+
import sys, yaml, os
|
|
544
|
+
path, ts, reason = sys.argv[1], sys.argv[2], sys.argv[3]
|
|
545
|
+
if not os.path.exists(path):
|
|
546
|
+
print(" No facts found for this entity.")
|
|
547
|
+
sys.exit(0)
|
|
548
|
+
facts = yaml.safe_load(open(path)) or []
|
|
549
|
+
active = [f for f in facts if f.get("status") == "active"]
|
|
550
|
+
for f in active:
|
|
551
|
+
f["status"] = "superseded"
|
|
552
|
+
f["supersededAt"] = ts
|
|
553
|
+
f["supersededReason"] = reason
|
|
554
|
+
with open(path, "w") as out:
|
|
555
|
+
yaml.dump(facts, out, default_flow_style=False, allow_unicode=True)
|
|
556
|
+
print(f" {len(active)} fact(s) superseded in {path}")
|
|
557
|
+
PYEOF
|
|
558
|
+
```
|
|
559
|
+
|
|
560
|
+
### synthesize
|
|
561
|
+
|
|
562
|
+
Rebuild summary.md for an entity from its active facts.
|
|
563
|
+
|
|
564
|
+
```bash
|
|
565
|
+
topicSlug=$(echo "${topic}" | tr '[:upper:]' '[:lower:]' | tr ' ' '-' | tr -cd 'a-z0-9-')
|
|
566
|
+
category="${category:-resources}"
|
|
567
|
+
entityDir="$memRoot/knowledge/${category}/${topicSlug}"
|
|
568
|
+
ypath="$entityDir/items.yaml"
|
|
569
|
+
[ ! -f "$ypath" ] && { echo " No facts found for '${topic}'."; exit 0; }
|
|
570
|
+
|
|
571
|
+
python3 - "$ypath" "$entityDir/summary.md" "${topic}" <<'PYEOF'
|
|
572
|
+
import sys, yaml
|
|
573
|
+
ypath, sumpath, topic = sys.argv[1], sys.argv[2], sys.argv[3]
|
|
574
|
+
facts = [f for f in (yaml.safe_load(open(ypath)) or []) if f.get("status") == "active"]
|
|
575
|
+
lines = [f"# {topic}", "", f"{len(facts)} active fact(s):", ""]
|
|
576
|
+
for f in facts:
|
|
577
|
+
date = str(f.get("createdAt","?"))[:10]
|
|
578
|
+
lines.append(f"- [{date}] {f.get('body','')}")
|
|
579
|
+
open(sumpath, "w").write("\n".join(lines) + "\n")
|
|
580
|
+
print(f" Summary rebuilt: {sumpath}")
|
|
581
|
+
PYEOF
|
|
582
|
+
```
|
|
583
|
+
|
|
584
|
+
### decay
|
|
585
|
+
|
|
586
|
+
Archive entities with no facts updated in the last 90 days.
|
|
587
|
+
|
|
588
|
+
```bash
|
|
589
|
+
ts=$(date -u +%Y-%m-%dT%H:%M:%SZ)
|
|
590
|
+
|
|
591
|
+
python3 - "$memRoot/knowledge" "$ts" <<'PYEOF'
|
|
592
|
+
import os, sys, yaml, shutil
|
|
593
|
+
from datetime import datetime, timedelta
|
|
594
|
+
kg, ts = sys.argv[1], sys.argv[2]
|
|
595
|
+
cutoff = datetime.utcnow() - timedelta(days=90)
|
|
596
|
+
archived = 0
|
|
597
|
+
for cat in ["projects","areas","resources"]:
|
|
598
|
+
cpath = os.path.join(kg, cat)
|
|
599
|
+
if not os.path.isdir(cpath): continue
|
|
600
|
+
for topic in os.listdir(cpath):
|
|
601
|
+
ypath = os.path.join(cpath, topic, "items.yaml")
|
|
602
|
+
if not os.path.exists(ypath): continue
|
|
603
|
+
try:
|
|
604
|
+
facts = yaml.safe_load(open(ypath)) or []
|
|
605
|
+
active = [f for f in facts if f.get("status") == "active"]
|
|
606
|
+
if not active: continue
|
|
607
|
+
last = max(f.get("createdAt","")[:19] for f in active)
|
|
608
|
+
dt = datetime.fromisoformat(last)
|
|
609
|
+
if dt < cutoff:
|
|
610
|
+
dst = os.path.join(kg, "archives", topic)
|
|
611
|
+
shutil.move(os.path.join(cpath, topic), dst)
|
|
612
|
+
archived += 1
|
|
613
|
+
print(f" Archived: {cat}/{topic} (last active: {last[:10]})")
|
|
614
|
+
except: pass
|
|
615
|
+
print(f"\n Decay complete: {archived} entity/entities moved to archives.")
|
|
616
|
+
PYEOF
|
|
617
|
+
```
|
|
618
|
+
|
|
619
|
+
---
|
|
620
|
+
|
|
621
|
+
## Step 3 — Return Output
|
|
622
|
+
|
|
623
|
+
```yaml
|
|
624
|
+
domain: ops
|
|
625
|
+
status: complete
|
|
626
|
+
action: <action>
|
|
627
|
+
org_name: <org_name>
|
|
628
|
+
layer: <layer>
|
|
629
|
+
topic: <topic>
|
|
630
|
+
```
|
|
631
|
+
|
|
632
|
+
---
|
|
633
|
+
|
|
634
|
+
## Step 4 — Brain Write (standalone only)
|
|
635
|
+
|
|
636
|
+
If `caller` is not "command", follow mastermind-protocol/SKILL.md Brain Write Procedure for domain `ops`.
|
|
637
|
+
# monomind:end skills:claude:mastermind-memory
|