create-hq 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/deps.d.ts +4 -0
- package/dist/deps.d.ts.map +1 -0
- package/dist/deps.js +65 -0
- package/dist/deps.js.map +1 -0
- package/dist/git.d.ts +3 -0
- package/dist/git.d.ts.map +1 -0
- package/dist/git.js +19 -0
- package/dist/git.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +23 -0
- package/dist/index.js.map +1 -0
- package/dist/scaffold.d.ts +8 -0
- package/dist/scaffold.d.ts.map +1 -0
- package/dist/scaffold.js +130 -0
- package/dist/scaffold.js.map +1 -0
- package/dist/ui.d.ts +7 -0
- package/dist/ui.d.ts.map +1 -0
- package/dist/ui.js +36 -0
- package/dist/ui.js.map +1 -0
- package/package.json +41 -0
- package/template/.claude/CLAUDE.md +202 -0
- package/template/.claude/commands/checkpoint.md +127 -0
- package/template/.claude/commands/cleanup.md +307 -0
- package/template/.claude/commands/execute-task.md +440 -0
- package/template/.claude/commands/exit-plan.md +41 -0
- package/template/.claude/commands/handoff.md +97 -0
- package/template/.claude/commands/learn.md +218 -0
- package/template/.claude/commands/metrics.md +118 -0
- package/template/.claude/commands/newworker.md +162 -0
- package/template/.claude/commands/nexttask.md +67 -0
- package/template/.claude/commands/prd.md +238 -0
- package/template/.claude/commands/reanchor.md +51 -0
- package/template/.claude/commands/remember.md +126 -0
- package/template/.claude/commands/run-project.md +348 -0
- package/template/.claude/commands/run.md +110 -0
- package/template/.claude/commands/search-reindex.md +62 -0
- package/template/.claude/commands/search.md +100 -0
- package/template/.claude/commands/setup.md +381 -0
- package/template/.claude/scripts/pure-ralph-loop.ps1 +312 -0
- package/template/.claude/scripts/pure-ralph-loop.sh +859 -0
- package/template/CHANGELOG.md +220 -0
- package/template/LICENSE +21 -0
- package/template/MIGRATION.md +259 -0
- package/template/README.md +368 -0
- package/template/data/journal/.gitkeep +0 -0
- package/template/docs/images/ascii-banner-options.md +122 -0
- package/template/docs/images/hq-banner.svg +105 -0
- package/template/knowledge/Ralph/01-overview.md +71 -0
- package/template/knowledge/Ralph/02-core-concepts.md +114 -0
- package/template/knowledge/Ralph/03-how-ralph-works.md +184 -0
- package/template/knowledge/Ralph/04-back-pressure.md +222 -0
- package/template/knowledge/Ralph/05-specifications.md +210 -0
- package/template/knowledge/Ralph/06-agents-md.md +222 -0
- package/template/knowledge/Ralph/07-implementation.md +316 -0
- package/template/knowledge/Ralph/08-economics.md +182 -0
- package/template/knowledge/Ralph/09-resources.md +145 -0
- package/template/knowledge/Ralph/10-claude-code-workflow.md +212 -0
- package/template/knowledge/Ralph/11-team-training-guide.md +383 -0
- package/template/knowledge/Ralph/README.md +40 -0
- package/template/knowledge/ai-security-framework/CONTRIBUTING.md +139 -0
- package/template/knowledge/ai-security-framework/GLOSSARY.md +176 -0
- package/template/knowledge/ai-security-framework/LICENSE +21 -0
- package/template/knowledge/ai-security-framework/QUICK-START.md +172 -0
- package/template/knowledge/ai-security-framework/README.md +232 -0
- package/template/knowledge/ai-security-framework/checklists/browser-security.md +301 -0
- package/template/knowledge/ai-security-framework/checklists/credential-isolation.md +322 -0
- package/template/knowledge/ai-security-framework/checklists/incident-response.md +288 -0
- package/template/knowledge/ai-security-framework/checklists/pre-flight.md +249 -0
- package/template/knowledge/ai-security-framework/checklists/weekly-audit.md +159 -0
- package/template/knowledge/ai-security-framework/configs/audit-logging.md +372 -0
- package/template/knowledge/ai-security-framework/configs/kill-switches.md +354 -0
- package/template/knowledge/ai-security-framework/docs/01-core-principles.md +256 -0
- package/template/knowledge/ai-security-framework/docs/02-threat-landscape.md +326 -0
- package/template/knowledge/ai-security-framework/docs/03-security-posture.md +250 -0
- package/template/knowledge/ai-security-framework/templates/agents-security.md +233 -0
- package/template/knowledge/design-styles/README.md +42 -0
- package/template/knowledge/design-styles/american-industrial.md +136 -0
- package/template/knowledge/design-styles/ethereal-abstract.md +133 -0
- package/template/knowledge/design-styles/liminal-portal.md +111 -0
- package/template/knowledge/design-styles/swipes/american-industrial/G-3m4YPW0AADdu2.jpeg +0 -0
- package/template/knowledge/design-styles/swipes/american-industrial/G-JJlt5WwAABK3K.png +0 -0
- package/template/knowledge/design-styles/swipes/american-industrial/G-JJmj5W0AEbJ-7.png +0 -0
- package/template/knowledge/design-styles/swipes/american-industrial/G59fgNuXkAAKLJQ (1).jpeg +0 -0
- package/template/knowledge/design-styles/swipes/american-industrial/G59fgNuXkAAKLJQ.jpeg +0 -0
- package/template/knowledge/design-styles/swipes/american-industrial/G7fVkn3WEAAM-ST.jpeg +0 -0
- package/template/knowledge/design-styles/swipes/american-industrial/G8ECO5JWEAIksyn.png +0 -0
- package/template/knowledge/design-styles/swipes/american-industrial/G9-3GQSWoAA8eqZ.png +0 -0
- package/template/knowledge/design-styles/swipes/american-industrial/G9xEOqrXkAEZRcs.png +0 -0
- package/template/knowledge/design-styles/swipes/american-industrial/G_MVeJrXQAA8sx4.jpeg +0 -0
- package/template/knowledge/design-styles/swipes/american-industrial/G_RSkmGXkAAgAVZ.png +0 -0
- package/template/knowledge/design-styles/swipes/american-industrial/README.md +31 -0
- package/template/knowledge/design-styles/swipes/american-industrial/qyqtg7Dq.png +0 -0
- package/template/knowledge/dev-team/README.md +35 -0
- package/template/knowledge/dev-team/patterns/README.md +34 -0
- package/template/knowledge/dev-team/patterns/frontend/react-best-practices.md +178 -0
- package/template/knowledge/dev-team/troubleshooting/README.md +31 -0
- package/template/knowledge/dev-team/workflows/README.md +49 -0
- package/template/knowledge/hq/checkpoint-schema.json +51 -0
- package/template/knowledge/hq/index-md-spec.md +74 -0
- package/template/knowledge/hq/thread-schema.md +153 -0
- package/template/knowledge/hq-core/checkpoint-schema.json +51 -0
- package/template/knowledge/hq-core/index-md-spec.md +74 -0
- package/template/knowledge/hq-core/thread-schema.md +153 -0
- package/template/knowledge/loom/README.md +51 -0
- package/template/knowledge/loom/architecture.md +125 -0
- package/template/knowledge/loom/code-style.md +169 -0
- package/template/knowledge/loom/llm-proxy.md +132 -0
- package/template/knowledge/loom/state-machine.md +131 -0
- package/template/knowledge/loom/thread-system.md +117 -0
- package/template/knowledge/loom/tools.md +94 -0
- package/template/knowledge/loom/weaver.md +96 -0
- package/template/knowledge/loom/web-frontend.md +131 -0
- package/template/knowledge/projects/README.md +72 -0
- package/template/knowledge/projects/templates/README.template.md +28 -0
- package/template/knowledge/workers/README.md +195 -0
- package/template/knowledge/workers/ralph-loop-pattern.md +157 -0
- package/template/knowledge/workers/skill-schema.md +182 -0
- package/template/knowledge/workers/state-machine.md +102 -0
- package/template/knowledge/workers/templates/base-worker.yaml +73 -0
- package/template/knowledge/workers/templates/code-worker.yaml +85 -0
- package/template/knowledge/workers/templates/skill.yaml +49 -0
- package/template/knowledge/workers/templates/social-worker.yaml +70 -0
- package/template/modules/examples/full-manifest.yaml +92 -0
- package/template/modules/examples/minimal.yaml +14 -0
- package/template/modules/modules.yaml +59 -0
- package/template/projects/.gitkeep +0 -0
- package/template/projects/incorporate-workers-into-pure-ralph/prd.json +88 -0
- package/template/projects/pure-ralph-branch-isolation/README.md +114 -0
- package/template/projects/pure-ralph-branch-isolation/prd.json +123 -0
- package/template/projects/purist-ralph-loop/README.md +148 -0
- package/template/projects/purist-ralph-loop/prd.json +135 -0
- package/template/projects/ralph-test/prd.json +50 -0
- package/template/prompts/pure-ralph-base.md +551 -0
- package/template/settings/.gitkeep +0 -0
- package/template/settings/pure-ralph.json +42 -0
- package/template/social-content/drafts/INDEX.md +21 -0
- package/template/social-content/drafts/linkedin/.gitkeep +1 -0
- package/template/social-content/drafts/x/.gitkeep +1 -0
- package/template/social-content/images/.gitkeep +1 -0
- package/template/starter-projects/code-worker/README.md +97 -0
- package/template/starter-projects/code-worker/prd.json +45 -0
- package/template/starter-projects/personal-assistant/README.md +42 -0
- package/template/starter-projects/personal-assistant/prd.json +43 -0
- package/template/starter-projects/social-media/README.md +60 -0
- package/template/starter-projects/social-media/prd.json +43 -0
- package/template/workers/content-brand/README.md +59 -0
- package/template/workers/content-brand/skills/messaging-alignment.md +91 -0
- package/template/workers/content-brand/skills/tone-check.md +76 -0
- package/template/workers/content-brand/skills/voice-analysis.md +68 -0
- package/template/workers/content-brand/worker.yaml +81 -0
- package/template/workers/content-legal/README.md +80 -0
- package/template/workers/content-legal/skills/claim-substantiation.md +150 -0
- package/template/workers/content-legal/skills/compliance-scan.md +123 -0
- package/template/workers/content-legal/skills/disclaimer-check.md +146 -0
- package/template/workers/content-legal/worker.yaml +118 -0
- package/template/workers/content-product/README.md +77 -0
- package/template/workers/content-product/skills/claim-verification.md +96 -0
- package/template/workers/content-product/skills/feature-accuracy.md +117 -0
- package/template/workers/content-product/skills/stats-check.md +128 -0
- package/template/workers/content-product/worker.yaml +97 -0
- package/template/workers/content-sales/README.md +70 -0
- package/template/workers/content-sales/skills/conversion-analysis.md +96 -0
- package/template/workers/content-sales/skills/cta-audit.md +107 -0
- package/template/workers/content-sales/skills/value-prop-check.md +114 -0
- package/template/workers/content-sales/worker.yaml +93 -0
- package/template/workers/content-shared/cli.ts +242 -0
- package/template/workers/content-shared/index.ts +234 -0
- package/template/workers/content-shared/lib/accuracy-analyzer.ts +661 -0
- package/template/workers/content-shared/lib/analyze.ts +370 -0
- package/template/workers/content-shared/lib/brand-analyzer.ts +526 -0
- package/template/workers/content-shared/lib/cms-integration.ts +446 -0
- package/template/workers/content-shared/lib/compliance-analyzer.ts +655 -0
- package/template/workers/content-shared/lib/conversion-analyzer.ts +555 -0
- package/template/workers/content-shared/lib/github-integration.ts +582 -0
- package/template/workers/content-shared/lib/output.ts +373 -0
- package/template/workers/content-shared/lib/parser.ts +771 -0
- package/template/workers/content-shared/lib/priority.ts +439 -0
- package/template/workers/content-shared/lib/recommendations.ts +512 -0
- package/template/workers/content-shared/lib/reporter.ts +749 -0
- package/template/workers/content-shared/lib/restructure.ts +664 -0
- package/template/workers/content-shared/lib/scorer.ts +140 -0
- package/template/workers/content-shared/lib/types.ts +227 -0
- package/template/workers/content-shared/lib/variants.ts +595 -0
- package/template/workers/content-shared/package.json +51 -0
- package/template/workers/content-shared/pnpm-lock.yaml +39 -0
- package/template/workers/content-shared/test/sample-page.json +115 -0
- package/template/workers/content-shared/tsconfig.json +20 -0
- package/template/workers/dev-team/README.md +166 -0
- package/template/workers/dev-team/_template.yaml +70 -0
- package/template/workers/dev-team/architect/package.json +27 -0
- package/template/workers/dev-team/architect/skills/api-design.md +89 -0
- package/template/workers/dev-team/architect/skills/refactor-plan.md +96 -0
- package/template/workers/dev-team/architect/skills/system-design.md +100 -0
- package/template/workers/dev-team/architect/src/index.ts +49 -0
- package/template/workers/dev-team/architect/src/mcp-server.ts +122 -0
- package/template/workers/dev-team/architect/src/skills/api-design.ts +316 -0
- package/template/workers/dev-team/architect/src/skills/refactor-plan.ts +264 -0
- package/template/workers/dev-team/architect/src/skills/system-design.ts +212 -0
- package/template/workers/dev-team/architect/tsconfig.json +19 -0
- package/template/workers/dev-team/architect/worker.yaml +128 -0
- package/template/workers/dev-team/backend-dev/package-lock.json +1252 -0
- package/template/workers/dev-team/backend-dev/package.json +27 -0
- package/template/workers/dev-team/backend-dev/skills/implement-endpoint.md +70 -0
- package/template/workers/dev-team/backend-dev/skills/implement-service.md +62 -0
- package/template/workers/dev-team/backend-dev/src/index.ts +51 -0
- package/template/workers/dev-team/backend-dev/src/mcp-server.ts +109 -0
- package/template/workers/dev-team/backend-dev/src/skills/implement-endpoint.ts +122 -0
- package/template/workers/dev-team/backend-dev/src/skills/implement-service.ts +126 -0
- package/template/workers/dev-team/backend-dev/tsconfig.json +19 -0
- package/template/workers/dev-team/backend-dev/worker.yaml +128 -0
- package/template/workers/dev-team/code-reviewer/package-lock.json +1080 -0
- package/template/workers/dev-team/code-reviewer/package.json +24 -0
- package/template/workers/dev-team/code-reviewer/skills/merge-to-production.md +61 -0
- package/template/workers/dev-team/code-reviewer/skills/merge-to-staging.md +54 -0
- package/template/workers/dev-team/code-reviewer/skills/request-changes.md +63 -0
- package/template/workers/dev-team/code-reviewer/skills/review-pr.md +77 -0
- package/template/workers/dev-team/code-reviewer/src/index.ts +56 -0
- package/template/workers/dev-team/code-reviewer/src/mcp-server.ts +101 -0
- package/template/workers/dev-team/code-reviewer/tsconfig.json +19 -0
- package/template/workers/dev-team/code-reviewer/worker.yaml +90 -0
- package/template/workers/dev-team/database-dev/package.json +22 -0
- package/template/workers/dev-team/database-dev/skills/create-schema.md +48 -0
- package/template/workers/dev-team/database-dev/src/index.ts +50 -0
- package/template/workers/dev-team/database-dev/src/mcp-server.ts +76 -0
- package/template/workers/dev-team/database-dev/tsconfig.json +18 -0
- package/template/workers/dev-team/database-dev/worker.yaml +90 -0
- package/template/workers/dev-team/frontend-dev/package.json +22 -0
- package/template/workers/dev-team/frontend-dev/skills/create-component.md +26 -0
- package/template/workers/dev-team/frontend-dev/src/index.ts +50 -0
- package/template/workers/dev-team/frontend-dev/src/mcp-server.ts +77 -0
- package/template/workers/dev-team/frontend-dev/tsconfig.json +18 -0
- package/template/workers/dev-team/frontend-dev/worker.yaml +132 -0
- package/template/workers/dev-team/infra-dev/package.json +24 -0
- package/template/workers/dev-team/infra-dev/skills/add-monitoring.md +73 -0
- package/template/workers/dev-team/infra-dev/skills/configure-deployment.md +80 -0
- package/template/workers/dev-team/infra-dev/skills/create-dockerfile.md +62 -0
- package/template/workers/dev-team/infra-dev/skills/setup-cicd.md +63 -0
- package/template/workers/dev-team/infra-dev/src/index.ts +55 -0
- package/template/workers/dev-team/infra-dev/src/mcp-server.ts +82 -0
- package/template/workers/dev-team/infra-dev/tsconfig.json +19 -0
- package/template/workers/dev-team/infra-dev/worker.yaml +92 -0
- package/template/workers/dev-team/knowledge-curator/package.json +24 -0
- package/template/workers/dev-team/knowledge-curator/skills/curate-troubleshooting.md +63 -0
- package/template/workers/dev-team/knowledge-curator/skills/process-learnings.md +61 -0
- package/template/workers/dev-team/knowledge-curator/skills/sync-documentation.md +76 -0
- package/template/workers/dev-team/knowledge-curator/skills/update-patterns.md +63 -0
- package/template/workers/dev-team/knowledge-curator/src/index.ts +53 -0
- package/template/workers/dev-team/knowledge-curator/src/mcp-server.ts +92 -0
- package/template/workers/dev-team/knowledge-curator/tsconfig.json +19 -0
- package/template/workers/dev-team/knowledge-curator/worker.yaml +80 -0
- package/template/workers/dev-team/motion-designer/package.json +22 -0
- package/template/workers/dev-team/motion-designer/skills/add-animation.md +25 -0
- package/template/workers/dev-team/motion-designer/skills/generate-image.md +36 -0
- package/template/workers/dev-team/motion-designer/src/index.ts +63 -0
- package/template/workers/dev-team/motion-designer/src/mcp-server.ts +79 -0
- package/template/workers/dev-team/motion-designer/tsconfig.json +18 -0
- package/template/workers/dev-team/motion-designer/worker.yaml +84 -0
- package/template/workers/dev-team/product-planner/queue.json +4 -0
- package/template/workers/dev-team/product-planner/worker.yaml +220 -0
- package/template/workers/dev-team/project-manager/package-lock.json +1252 -0
- package/template/workers/dev-team/project-manager/package.json +27 -0
- package/template/workers/dev-team/project-manager/skills/create-prd.md +66 -0
- package/template/workers/dev-team/project-manager/skills/next-issue.md +51 -0
- package/template/workers/dev-team/project-manager/skills/project-status.md +59 -0
- package/template/workers/dev-team/project-manager/skills/update-learnings.md +65 -0
- package/template/workers/dev-team/project-manager/src/index.ts +54 -0
- package/template/workers/dev-team/project-manager/src/mcp-server.ts +207 -0
- package/template/workers/dev-team/project-manager/src/skills/create-prd.ts +86 -0
- package/template/workers/dev-team/project-manager/src/skills/next-issue.ts +137 -0
- package/template/workers/dev-team/project-manager/src/skills/project-status.ts +131 -0
- package/template/workers/dev-team/project-manager/src/skills/update-learnings.ts +94 -0
- package/template/workers/dev-team/project-manager/tsconfig.json +19 -0
- package/template/workers/dev-team/project-manager/worker.yaml +96 -0
- package/template/workers/dev-team/qa-tester/package.json +24 -0
- package/template/workers/dev-team/qa-tester/skills/create-demo-account.md +36 -0
- package/template/workers/dev-team/qa-tester/skills/run-tests.md +36 -0
- package/template/workers/dev-team/qa-tester/skills/write-test.md +27 -0
- package/template/workers/dev-team/qa-tester/src/index.ts +61 -0
- package/template/workers/dev-team/qa-tester/src/mcp-server.ts +88 -0
- package/template/workers/dev-team/qa-tester/tsconfig.json +18 -0
- package/template/workers/dev-team/qa-tester/worker.yaml +116 -0
- package/template/workers/dev-team/task-executor/package-lock.json +1252 -0
- package/template/workers/dev-team/task-executor/package.json +27 -0
- package/template/workers/dev-team/task-executor/skills/analyze-issue.md +101 -0
- package/template/workers/dev-team/task-executor/skills/execute.md +133 -0
- package/template/workers/dev-team/task-executor/skills/report-learnings.md +106 -0
- package/template/workers/dev-team/task-executor/skills/validate-completion.md +121 -0
- package/template/workers/dev-team/task-executor/src/index.ts +54 -0
- package/template/workers/dev-team/task-executor/src/mcp-server.ts +139 -0
- package/template/workers/dev-team/task-executor/src/skills/analyze-issue.ts +219 -0
- package/template/workers/dev-team/task-executor/src/skills/execute.ts +132 -0
- package/template/workers/dev-team/task-executor/src/skills/report-learnings.ts +119 -0
- package/template/workers/dev-team/task-executor/src/skills/validate-completion.ts +142 -0
- package/template/workers/dev-team/task-executor/tsconfig.json +19 -0
- package/template/workers/dev-team/task-executor/worker.yaml +110 -0
- package/template/workers/registry.yaml +171 -0
- package/template/workers/security-scanner/README.md +73 -0
- package/template/workers/security-scanner/skills/pre-deploy-check.md +205 -0
- package/template/workers/security-scanner/worker.yaml +26 -0
- package/template/workspace/checkpoints/.gitkeep +0 -0
- package/template/workspace/content-ideas/inbox.jsonl +0 -0
- package/template/workspace/drafts/.gitkeep +0 -0
- package/template/workspace/learnings/.gitkeep +3 -0
- package/template/workspace/orchestrator/.gitkeep +0 -0
- package/template/workspace/ralph-test/COMPLETE.md +18 -0
- package/template/workspace/ralph-test/hello.txt +2 -0
- package/template/workspace/reports/.gitkeep +0 -0
- package/template/workspace/scratch/.gitkeep +0 -0
- package/template/workspace/threads/.gitkeep +3 -0
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# Weaver (Remote Execution)
|
|
2
|
+
|
|
3
|
+
Weavers are ephemeral Kubernetes pods for running remote Loom REPL sessions.
|
|
4
|
+
|
|
5
|
+
**Source**: `crates/loom-weaver-*/`, `crates/loom-wgtunnel-*/`
|
|
6
|
+
|
|
7
|
+
## Architecture
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
┌─────────────┐ WebSocket ┌─────────────┐ K8s API ┌─────────────┐
|
|
11
|
+
│ loom-cli │ ──────────────────▶│ loom-server │ ───────────────▶ │ K8s Pod │
|
|
12
|
+
│ │ │ │ │ (Weaver) │
|
|
13
|
+
│ attach │ ◀─────────────────│ /weavers │ ◀────────────────│ │
|
|
14
|
+
└─────────────┘ Terminal I/O └─────────────┘ WireGuard └─────────────┘
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## CLI Commands
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
# Login first
|
|
21
|
+
loom --server-url https://loom.ghuntley.com login
|
|
22
|
+
|
|
23
|
+
# Create new weaver
|
|
24
|
+
loom --server-url https://loom.ghuntley.com new --image <image>
|
|
25
|
+
|
|
26
|
+
# List weavers
|
|
27
|
+
loom --server-url https://loom.ghuntley.com weaver ps
|
|
28
|
+
|
|
29
|
+
# Attach to weaver
|
|
30
|
+
loom --server-url https://loom.ghuntley.com attach <weaver-id>
|
|
31
|
+
|
|
32
|
+
# Delete weaver
|
|
33
|
+
loom --server-url https://loom.ghuntley.com weaver delete <weaver-id>
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## K8s Namespace
|
|
37
|
+
|
|
38
|
+
Weavers run in `loom-weavers` namespace:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
# List pods
|
|
42
|
+
sudo kubectl get pods -n loom-weavers
|
|
43
|
+
|
|
44
|
+
# Describe pod
|
|
45
|
+
sudo kubectl describe pod <pod-name> -n loom-weavers
|
|
46
|
+
|
|
47
|
+
# Pod logs
|
|
48
|
+
sudo kubectl logs <pod-name> -n loom-weavers
|
|
49
|
+
|
|
50
|
+
# Delete stuck pod
|
|
51
|
+
sudo kubectl delete pod <pod-name> -n loom-weavers
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Crates
|
|
55
|
+
|
|
56
|
+
| Crate | Purpose |
|
|
57
|
+
|-------|---------|
|
|
58
|
+
| `loom-weaver-audit-sidecar` | Audit logging sidecar |
|
|
59
|
+
| `loom-weaver-ebpf` | eBPF syscall tracing |
|
|
60
|
+
| `loom-weaver-ebpf-common` | Shared eBPF types |
|
|
61
|
+
| `loom-weaver-secrets` | Secret injection |
|
|
62
|
+
| `loom-wgtunnel-common` | WireGuard common types |
|
|
63
|
+
| `loom-wgtunnel-conn` | Connection handling |
|
|
64
|
+
| `loom-wgtunnel-derp` | DERP relay support |
|
|
65
|
+
| `loom-wgtunnel-engine` | Tunnel engine |
|
|
66
|
+
| `loom-server-wgtunnel` | Server integration |
|
|
67
|
+
| `loom-server-weaver` | Server weaver management |
|
|
68
|
+
|
|
69
|
+
## Features
|
|
70
|
+
|
|
71
|
+
### WireGuard Tunneling
|
|
72
|
+
Secure tunnel between client and weaver pod via WireGuard with DERP relay fallback.
|
|
73
|
+
|
|
74
|
+
### eBPF Audit
|
|
75
|
+
`loom-weaver-ebpf` traces syscalls for security auditing:
|
|
76
|
+
- File operations
|
|
77
|
+
- Network activity
|
|
78
|
+
- Process spawning
|
|
79
|
+
|
|
80
|
+
### Secret Injection
|
|
81
|
+
`loom-weaver-secrets` injects secrets into weaver environment without exposing them in pod spec.
|
|
82
|
+
|
|
83
|
+
## Common Issues
|
|
84
|
+
|
|
85
|
+
| Issue | Cause | Fix |
|
|
86
|
+
|-------|-------|-----|
|
|
87
|
+
| ErrImagePull | Image doesn't exist or is private | Check `kubectl describe pod` |
|
|
88
|
+
| Succeeded immediately | Container has no long-running entrypoint | Weaver images must run persistent process |
|
|
89
|
+
| 401 Unauthorized | Not logged in | Run `loom login` first |
|
|
90
|
+
|
|
91
|
+
## Server Logs
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
# Weaver-related logs
|
|
95
|
+
journalctl -u loom-server -f
|
|
96
|
+
```
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
# Web Frontend
|
|
2
|
+
|
|
3
|
+
Svelte 5 web application with SvelteKit, Tailwind CSS 4, and xstate state machines.
|
|
4
|
+
|
|
5
|
+
**Source**: `web/loom-web/`
|
|
6
|
+
|
|
7
|
+
## Tech Stack
|
|
8
|
+
|
|
9
|
+
| Technology | Version | Purpose |
|
|
10
|
+
|------------|---------|---------|
|
|
11
|
+
| Svelte | 5 | UI framework (runes syntax) |
|
|
12
|
+
| SvelteKit | 2 | App framework |
|
|
13
|
+
| Tailwind CSS | 4 | Styling |
|
|
14
|
+
| xstate | - | State machines |
|
|
15
|
+
| xterm.js | - | Terminal emulator |
|
|
16
|
+
| marked | - | Markdown rendering |
|
|
17
|
+
| Storybook | - | Component development |
|
|
18
|
+
| Vitest | - | Testing |
|
|
19
|
+
| Lingui | - | i18n |
|
|
20
|
+
|
|
21
|
+
## Svelte 5 Runes (NOT Svelte 4)
|
|
22
|
+
|
|
23
|
+
**Always use Svelte 5 patterns. Never use Svelte 4.**
|
|
24
|
+
|
|
25
|
+
| Category | Svelte 5 | Svelte 4 (DO NOT USE) |
|
|
26
|
+
|----------|----------|----------------------|
|
|
27
|
+
| State | `let count = $state(0);` | `let count = 0;` |
|
|
28
|
+
| Derived | `const doubled = $derived(count * 2);` | `$: doubled = count * 2;` |
|
|
29
|
+
| Effects | `$effect(() => { ... });` | `$: { ... }` |
|
|
30
|
+
| Props | `let { foo, bar } = $props();` | `export let foo;` |
|
|
31
|
+
| Events | `onclick={handler}` | `on:click={handler}` |
|
|
32
|
+
| Custom events | `onsave={fn}` (callback props) | `createEventDispatcher` |
|
|
33
|
+
| Slots | `{@render children()}` | `<slot />` |
|
|
34
|
+
|
|
35
|
+
## Project Structure
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
web/loom-web/
|
|
39
|
+
├── src/
|
|
40
|
+
│ ├── app.html # Root HTML
|
|
41
|
+
│ ├── app.css # Global styles
|
|
42
|
+
│ ├── routes/ # SvelteKit routes
|
|
43
|
+
│ │ ├── (app)/ # Protected app routes
|
|
44
|
+
│ │ │ ├── admin/ # Admin panel
|
|
45
|
+
│ │ │ ├── dashboard/ # Main dashboard
|
|
46
|
+
│ │ │ ├── threads/ # Conversation threads
|
|
47
|
+
│ │ │ └── weavers/ # Remote execution
|
|
48
|
+
│ │ ├── (docs)/ # Documentation
|
|
49
|
+
│ │ ├── api/ # API routes
|
|
50
|
+
│ │ └── login/ # Auth flow
|
|
51
|
+
│ └── lib/
|
|
52
|
+
│ ├── api/ # HTTP client
|
|
53
|
+
│ ├── auth/ # Auth store & machine
|
|
54
|
+
│ ├── components/ # Page components
|
|
55
|
+
│ ├── docs/ # Doc system
|
|
56
|
+
│ ├── i18n/ # Internationalization
|
|
57
|
+
│ ├── logging/ # Client logging
|
|
58
|
+
│ ├── realtime/ # WebSocket/SSE
|
|
59
|
+
│ ├── state/ # State machines
|
|
60
|
+
│ └── ui/ # Reusable UI components
|
|
61
|
+
├── package.json
|
|
62
|
+
├── svelte.config.js
|
|
63
|
+
├── tailwind.config.cjs
|
|
64
|
+
└── vite.config.ts
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Key Components
|
|
68
|
+
|
|
69
|
+
### Page Components (`src/lib/components/`)
|
|
70
|
+
|
|
71
|
+
| Component | Purpose |
|
|
72
|
+
|-----------|---------|
|
|
73
|
+
| `MessageList.svelte` | Conversation message display |
|
|
74
|
+
| `MessageBubble.svelte` | Individual message |
|
|
75
|
+
| `MessageInput.svelte` | User input |
|
|
76
|
+
| `ThreadListPane.svelte` | Thread sidebar |
|
|
77
|
+
| `ThreadListItem.svelte` | Thread entry |
|
|
78
|
+
| `ToolExecutionPanel.svelte` | Tool call display |
|
|
79
|
+
| `WeaverTerminal.svelte` | xterm.js integration |
|
|
80
|
+
| `AgentStateTimeline.svelte` | State visualization |
|
|
81
|
+
| `ConnectionStatusIndicator.svelte` | Connection status |
|
|
82
|
+
|
|
83
|
+
### UI Components (`src/lib/ui/`)
|
|
84
|
+
|
|
85
|
+
| Component | Purpose |
|
|
86
|
+
|-----------|---------|
|
|
87
|
+
| `Button.svelte` | Button variants |
|
|
88
|
+
| `Input.svelte` | Text input |
|
|
89
|
+
| `Card.svelte` | Card container |
|
|
90
|
+
| `Badge.svelte` | Status badges |
|
|
91
|
+
| `Skeleton.svelte` | Loading skeleton |
|
|
92
|
+
| `Modal.svelte` | Modal dialog |
|
|
93
|
+
| `LoomFrame.svelte` | Main frame wrapper |
|
|
94
|
+
| `ThemeProvider.svelte` | Theme context |
|
|
95
|
+
|
|
96
|
+
## State Machines (`src/lib/state/`)
|
|
97
|
+
|
|
98
|
+
Uses xstate for complex state management:
|
|
99
|
+
|
|
100
|
+
| Machine | Purpose |
|
|
101
|
+
|---------|---------|
|
|
102
|
+
| `authMachine.ts` | Authentication flow |
|
|
103
|
+
| `connectionMachine.ts` | WebSocket connection |
|
|
104
|
+
| `conversationMachine.ts` | Conversation flow |
|
|
105
|
+
| `threadListMachine.ts` | Thread list state |
|
|
106
|
+
|
|
107
|
+
## Auth Store (`src/lib/auth/`)
|
|
108
|
+
|
|
109
|
+
```typescript
|
|
110
|
+
// authStore.svelte.ts - Svelte 5 runes store
|
|
111
|
+
let user = $state<User | null>(null);
|
|
112
|
+
let isAuthenticated = $derived(user !== null);
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## Development
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
cd web/loom-web
|
|
119
|
+
|
|
120
|
+
# Install dependencies
|
|
121
|
+
pnpm install
|
|
122
|
+
|
|
123
|
+
# Development server
|
|
124
|
+
pnpm dev
|
|
125
|
+
|
|
126
|
+
# Run tests
|
|
127
|
+
pnpm test
|
|
128
|
+
|
|
129
|
+
# Storybook
|
|
130
|
+
pnpm storybook
|
|
131
|
+
```
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# Projects
|
|
2
|
+
|
|
3
|
+
Guidelines for creating and tracking projects in HQ.
|
|
4
|
+
|
|
5
|
+
## When to Create a Project
|
|
6
|
+
|
|
7
|
+
Create a `projects/{name}/` folder when:
|
|
8
|
+
- Work spans multiple steps or sessions
|
|
9
|
+
- There are tangible deliverables (code, content, launches)
|
|
10
|
+
- You'd want to reference the work later
|
|
11
|
+
|
|
12
|
+
**Do not create** for:
|
|
13
|
+
- One-off questions or research
|
|
14
|
+
- Quick fixes (< 30 min)
|
|
15
|
+
- Pure conversation without deliverables
|
|
16
|
+
|
|
17
|
+
## Project Structure
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
projects/{name}/
|
|
21
|
+
├── README.md # Required - overview, status, log
|
|
22
|
+
├── prd.json # Required for multi-feature projects
|
|
23
|
+
└── CLAUDE.md # Optional - project-specific rules
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## README.md (Required)
|
|
27
|
+
|
|
28
|
+
Use the template at `knowledge/projects/templates/README.template.md`.
|
|
29
|
+
|
|
30
|
+
Key sections:
|
|
31
|
+
- **Overview**: 1-2 sentences
|
|
32
|
+
- **Status**: Phase + repo link
|
|
33
|
+
- **Deliverables**: Checklist of what's being built
|
|
34
|
+
- **Log**: Date/action/outcome table updated as work progresses
|
|
35
|
+
|
|
36
|
+
## prd.json (Required for Multi-Feature)
|
|
37
|
+
|
|
38
|
+
```json
|
|
39
|
+
{
|
|
40
|
+
"project": "project-name",
|
|
41
|
+
"goal": "what it achieves",
|
|
42
|
+
"success_criteria": "how to know it's done",
|
|
43
|
+
"repo": "repos/private/{name}/",
|
|
44
|
+
"features": [
|
|
45
|
+
{"id": "F1", "title": "Feature name", "passes": false}
|
|
46
|
+
]
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Linking to Repos
|
|
51
|
+
|
|
52
|
+
If project has code:
|
|
53
|
+
- Repo goes in `repos/private/{name}/` or `repos/public/{name}/`
|
|
54
|
+
- README.md references: `**Repo**: repos/private/{name}/`
|
|
55
|
+
|
|
56
|
+
## Session Protocol
|
|
57
|
+
|
|
58
|
+
1. **Start of session**: Create `projects/{name}/README.md` if new project
|
|
59
|
+
2. **During session**: Update log table after major milestones
|
|
60
|
+
3. **End of session**: Ensure README reflects current state
|
|
61
|
+
|
|
62
|
+
## Examples
|
|
63
|
+
|
|
64
|
+
Good project folders:
|
|
65
|
+
- `projects/my-app/` - Mobile app
|
|
66
|
+
- `projects/token-launch/` - Token launch
|
|
67
|
+
- `projects/site-migration/` - Website migration
|
|
68
|
+
|
|
69
|
+
Not projects (too small):
|
|
70
|
+
- Fix a typo in docs
|
|
71
|
+
- Answer a question about code
|
|
72
|
+
- Run a one-time report
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# {Project Name}
|
|
2
|
+
|
|
3
|
+
{1-2 sentence description}
|
|
4
|
+
|
|
5
|
+
## Status
|
|
6
|
+
|
|
7
|
+
**Phase**: {Discovery|MVP|Launch|Complete}
|
|
8
|
+
**Repo**: `repos/private/{repo-name}/` (if applicable)
|
|
9
|
+
|
|
10
|
+
## Goals
|
|
11
|
+
|
|
12
|
+
- {what success looks like}
|
|
13
|
+
|
|
14
|
+
## Deliverables
|
|
15
|
+
|
|
16
|
+
- [ ] {deliverable 1}
|
|
17
|
+
- [ ] {deliverable 2}
|
|
18
|
+
|
|
19
|
+
## Key Links
|
|
20
|
+
|
|
21
|
+
- {link 1}
|
|
22
|
+
- {link 2}
|
|
23
|
+
|
|
24
|
+
## Log
|
|
25
|
+
|
|
26
|
+
| Date | Action | Outcome |
|
|
27
|
+
|------|--------|---------|
|
|
28
|
+
| {YYYY-MM-DD} | {what was done} | {result} |
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
# Workers
|
|
2
|
+
|
|
3
|
+
Workers are autonomous AI assistants with specialized roles. This knowledge base documents the Workers framework and how to build/operate them.
|
|
4
|
+
|
|
5
|
+
## Philosophy
|
|
6
|
+
|
|
7
|
+
**Workers, not Agents**
|
|
8
|
+
- "Agent" is technical jargon
|
|
9
|
+
- "Worker" is human, relatable
|
|
10
|
+
- Workers have jobs, context, and output
|
|
11
|
+
- They do real work, not just assist
|
|
12
|
+
|
|
13
|
+
**Built on Ralph Principles**
|
|
14
|
+
- ONE task at a time
|
|
15
|
+
- Fresh context per task (no context rot)
|
|
16
|
+
- Back pressure verification before completion
|
|
17
|
+
- Simple loops over complex orchestration
|
|
18
|
+
|
|
19
|
+
## Worker Types
|
|
20
|
+
|
|
21
|
+
| Type | Purpose | Example |
|
|
22
|
+
|------|---------|---------|
|
|
23
|
+
| **CodeWorker** | Implement features, fix bugs | dev-team workers |
|
|
24
|
+
| **SocialWorker** | Draft posts, maintain presence | x-worker |
|
|
25
|
+
| **ResearchWorker** | Competitive analysis, market research | analyst |
|
|
26
|
+
| **OpsWorker** | Monitoring, automation, reports | cfo-worker |
|
|
27
|
+
|
|
28
|
+
## Building Workers (Build Mode)
|
|
29
|
+
|
|
30
|
+
When creating or modifying workers, follow this structure:
|
|
31
|
+
|
|
32
|
+
### Worker Definition (`worker.yaml`)
|
|
33
|
+
|
|
34
|
+
```yaml
|
|
35
|
+
id: worker-id
|
|
36
|
+
name: Human-readable Name
|
|
37
|
+
type: WorkerType
|
|
38
|
+
status: active|planned|deprecated
|
|
39
|
+
|
|
40
|
+
context:
|
|
41
|
+
base:
|
|
42
|
+
- path/to/always/load.md
|
|
43
|
+
dynamic:
|
|
44
|
+
- pattern: "*.yaml"
|
|
45
|
+
when: "task.type == 'config'"
|
|
46
|
+
|
|
47
|
+
skills:
|
|
48
|
+
- id: skill-name
|
|
49
|
+
description: What this skill does
|
|
50
|
+
inputs: [required, parameters]
|
|
51
|
+
outputs: [what, it, produces]
|
|
52
|
+
verification:
|
|
53
|
+
- command: "npm run typecheck"
|
|
54
|
+
must_pass: true
|
|
55
|
+
|
|
56
|
+
schedule:
|
|
57
|
+
type: on-demand|cron|event
|
|
58
|
+
cron: "0 8 * * *" # if cron type
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### File Structure
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
workers/
|
|
65
|
+
├── registry.yaml # Index of all workers
|
|
66
|
+
├── {category}/
|
|
67
|
+
│ └── {worker-id}/
|
|
68
|
+
│ ├── worker.yaml # Definition
|
|
69
|
+
│ ├── prd.json # If code-based, task tracking
|
|
70
|
+
│ └── skills/ # Skill implementations
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Build Checklist
|
|
74
|
+
|
|
75
|
+
1. Add entry to `workers/registry.yaml`
|
|
76
|
+
2. Create `workers/{category}/{id}/worker.yaml`
|
|
77
|
+
3. Define skills with clear inputs/outputs/verification
|
|
78
|
+
4. Test with on-demand execution first
|
|
79
|
+
5. Document in this knowledge base if patterns emerge
|
|
80
|
+
|
|
81
|
+
## Running Workers (Work Mode)
|
|
82
|
+
|
|
83
|
+
### On-Demand Execution
|
|
84
|
+
|
|
85
|
+
```
|
|
86
|
+
"Run the analyst anomaly check"
|
|
87
|
+
"Execute cfo-worker monthly report"
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
The agent will:
|
|
91
|
+
1. Load the worker's context
|
|
92
|
+
2. Execute the relevant skill
|
|
93
|
+
3. Run verification checks
|
|
94
|
+
4. Output results
|
|
95
|
+
|
|
96
|
+
### Ralph Loop Pattern
|
|
97
|
+
|
|
98
|
+
For multi-task projects (3+ tasks), use the orchestrator pattern:
|
|
99
|
+
|
|
100
|
+
```
|
|
101
|
+
Orchestrator (main agent):
|
|
102
|
+
- Read PRD/task list
|
|
103
|
+
- Pick ONE task (status: pending)
|
|
104
|
+
- Spawn sub-agent via Task tool
|
|
105
|
+
- Read checkpoint when done
|
|
106
|
+
- Update task status
|
|
107
|
+
- Repeat until all tasks done
|
|
108
|
+
|
|
109
|
+
Sub-agent (spawned):
|
|
110
|
+
- Fresh 100% context
|
|
111
|
+
- Implements ONE task
|
|
112
|
+
- Runs back pressure (typecheck, build, tests)
|
|
113
|
+
- Writes checkpoint
|
|
114
|
+
- Exits
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
**Why this pattern:**
|
|
118
|
+
- Main agent context stays light (<30%)
|
|
119
|
+
- Sub-agents get full context per task
|
|
120
|
+
- Parallel execution possible for independent tasks
|
|
121
|
+
- Clear audit trail via checkpoints
|
|
122
|
+
|
|
123
|
+
**Spawn template:**
|
|
124
|
+
```
|
|
125
|
+
Task({
|
|
126
|
+
subagent_type: "general-purpose",
|
|
127
|
+
prompt: `
|
|
128
|
+
Task: {id} - {title}
|
|
129
|
+
|
|
130
|
+
Acceptance criteria:
|
|
131
|
+
- {criteria}
|
|
132
|
+
|
|
133
|
+
Files: {file_paths}
|
|
134
|
+
|
|
135
|
+
Instructions:
|
|
136
|
+
1. Implement the task
|
|
137
|
+
2. Run verification: {verification_command}
|
|
138
|
+
3. Commit: "feat({id}): {title}"
|
|
139
|
+
4. Write checkpoint to workspace/checkpoints/{id}.json
|
|
140
|
+
5. Exit
|
|
141
|
+
`
|
|
142
|
+
})
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### Checkpointing
|
|
146
|
+
|
|
147
|
+
After significant progress, write state:
|
|
148
|
+
|
|
149
|
+
```json
|
|
150
|
+
{
|
|
151
|
+
"task_id": "string",
|
|
152
|
+
"completed_at": "ISO8601",
|
|
153
|
+
"summary": "what was done",
|
|
154
|
+
"next_steps": ["array"],
|
|
155
|
+
"files_touched": ["paths"]
|
|
156
|
+
}
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
Location: `workspace/checkpoints/{task-id}.json`
|
|
160
|
+
|
|
161
|
+
## Back Pressure
|
|
162
|
+
|
|
163
|
+
Every worker skill should define verification checks:
|
|
164
|
+
|
|
165
|
+
| Type | Example | When |
|
|
166
|
+
|------|---------|------|
|
|
167
|
+
| Code | `npm run typecheck && npm run build` | After code changes |
|
|
168
|
+
| Tests | `npm test` | After feature implementation |
|
|
169
|
+
| Lint | `npm run lint` | Before commit |
|
|
170
|
+
| Voice | Compare against style guide | Social/content workers |
|
|
171
|
+
|
|
172
|
+
**Rule:** Never mark a task complete without passing verification.
|
|
173
|
+
|
|
174
|
+
## Registry
|
|
175
|
+
|
|
176
|
+
All workers are indexed in `workers/registry.yaml`:
|
|
177
|
+
|
|
178
|
+
```yaml
|
|
179
|
+
workers:
|
|
180
|
+
- id: worker-id
|
|
181
|
+
path: workers/category/worker-id/
|
|
182
|
+
type: WorkerType
|
|
183
|
+
status: active|planned
|
|
184
|
+
description: "What this worker does"
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
## See Also
|
|
188
|
+
|
|
189
|
+
- [Ralph Methodology](../Ralph/) - Core principles
|
|
190
|
+
- [ralph-loop-pattern.md](./ralph-loop-pattern.md) - Detailed loop docs
|
|
191
|
+
- [state-machine.md](./state-machine.md) - Worker state machine (Loom pattern)
|
|
192
|
+
- [skill-schema.md](./skill-schema.md) - Skill interface specification
|
|
193
|
+
- [Thread Schema](../hq-core/thread-schema.md) - Thread persistence format
|
|
194
|
+
- [Loom Patterns](../loom/) - Reference implementation
|
|
195
|
+
- Individual worker docs in `workers/{category}/{id}/`
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
# Ralph Loop Pattern: Context-Preserving Task Execution
|
|
2
|
+
|
|
3
|
+
## Problem
|
|
4
|
+
Long implementation sessions drain orchestrator context. By task 7, context is 80%+ full, responses slow, risk of forgetting earlier decisions.
|
|
5
|
+
|
|
6
|
+
## Solution
|
|
7
|
+
Orchestrator stays lean. Sub-agents do heavy lifting.
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
┌─────────────────────────────────────┐
|
|
11
|
+
│ ORCHESTRATOR │
|
|
12
|
+
│ - Reads PRD │
|
|
13
|
+
│ - Picks ONE task (passes: false) │
|
|
14
|
+
│ - Spawns sub-agent with task spec │
|
|
15
|
+
│ - Reads checkpoint when done │
|
|
16
|
+
│ - Updates PRD (passes: true) │
|
|
17
|
+
│ - Repeats until all pass │
|
|
18
|
+
│ │
|
|
19
|
+
│ Context usage: ~10-20% (stays low) │
|
|
20
|
+
└─────────────────────────────────────┘
|
|
21
|
+
│
|
|
22
|
+
▼ spawn
|
|
23
|
+
┌─────────────────────────────────────┐
|
|
24
|
+
│ SUB-AGENT │
|
|
25
|
+
│ - Receives: task spec, file paths │
|
|
26
|
+
│ - Implements feature │
|
|
27
|
+
│ - Runs back pressure │
|
|
28
|
+
│ - Commits code │
|
|
29
|
+
│ - Writes checkpoint │
|
|
30
|
+
│ - Exits │
|
|
31
|
+
│ │
|
|
32
|
+
│ Context: fresh per task, 100% avail│
|
|
33
|
+
└─────────────────────────────────────┘
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Implementation
|
|
37
|
+
|
|
38
|
+
### 1. Orchestrator Prompt Pattern
|
|
39
|
+
|
|
40
|
+
When starting a Ralph loop:
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
I am the orchestrator. I will:
|
|
44
|
+
1. Read PRD to find next task
|
|
45
|
+
2. Use Task tool to spawn implementation agent
|
|
46
|
+
3. Wait for checkpoint
|
|
47
|
+
4. Update PRD and continue
|
|
48
|
+
|
|
49
|
+
I will NOT write code directly. Sub-agents handle implementation.
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### 2. Sub-Agent Spawn Template
|
|
53
|
+
|
|
54
|
+
```typescript
|
|
55
|
+
// Use Task tool with Bash subagent for implementation
|
|
56
|
+
Task({
|
|
57
|
+
subagent_type: "Bash", // or custom "implement" agent
|
|
58
|
+
prompt: `
|
|
59
|
+
## Task: ${task.id} - ${task.title}
|
|
60
|
+
|
|
61
|
+
## Acceptance Criteria
|
|
62
|
+
${task.acceptance_criteria.join('\n')}
|
|
63
|
+
|
|
64
|
+
## Files to Create/Modify
|
|
65
|
+
${task.files.join('\n')}
|
|
66
|
+
|
|
67
|
+
## Instructions
|
|
68
|
+
1. Read existing code in ${task.files[0]} (if exists)
|
|
69
|
+
2. Implement the feature
|
|
70
|
+
3. Run: npm run typecheck && npm run build
|
|
71
|
+
4. If pass, commit with message: "feat(${task.id}): ${task.title}"
|
|
72
|
+
5. Write checkpoint to workspace/checkpoints/${task.id}.json
|
|
73
|
+
|
|
74
|
+
## Checkpoint Format
|
|
75
|
+
{
|
|
76
|
+
"task_id": "${task.id}",
|
|
77
|
+
"completed_at": "ISO8601",
|
|
78
|
+
"summary": "what was done",
|
|
79
|
+
"files_touched": ["paths"],
|
|
80
|
+
"build_passed": true/false
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
Exit when checkpoint is written.
|
|
84
|
+
`
|
|
85
|
+
})
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### 3. Worker Config Addition
|
|
89
|
+
|
|
90
|
+
```yaml
|
|
91
|
+
# workers/assistant/email/worker.yaml
|
|
92
|
+
execution:
|
|
93
|
+
mode: on-demand
|
|
94
|
+
spawn_per_task: true # KEY: spawn sub-agent per task
|
|
95
|
+
orchestrator_only: true # orchestrator doesn't implement directly
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### 4. HQ CLAUDE.md Addition
|
|
99
|
+
|
|
100
|
+
Add to `.claude/CLAUDE.md`:
|
|
101
|
+
|
|
102
|
+
```markdown
|
|
103
|
+
## Ralph Loop Execution (Multi-Task Projects)
|
|
104
|
+
|
|
105
|
+
For projects with 3+ tasks:
|
|
106
|
+
|
|
107
|
+
1. **Act as orchestrator only** - don't implement directly
|
|
108
|
+
2. **Spawn sub-agents** for each task using Task tool
|
|
109
|
+
3. **Keep context lean** by delegating implementation
|
|
110
|
+
|
|
111
|
+
### Spawning Implementation Agents
|
|
112
|
+
|
|
113
|
+
Use Task tool with focused prompts:
|
|
114
|
+
|
|
115
|
+
- Include ONLY the current task spec
|
|
116
|
+
- List specific files to modify
|
|
117
|
+
- Specify back pressure commands
|
|
118
|
+
- Require checkpoint on completion
|
|
119
|
+
|
|
120
|
+
### Example
|
|
121
|
+
|
|
122
|
+
Instead of:
|
|
123
|
+
```
|
|
124
|
+
[Orchestrator reads PRD, implements task 1, implements task 2...]
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Do:
|
|
128
|
+
```
|
|
129
|
+
[Orchestrator reads PRD]
|
|
130
|
+
[Spawns agent for task 1]
|
|
131
|
+
[Reads checkpoint]
|
|
132
|
+
[Spawns agent for task 2]
|
|
133
|
+
[Reads checkpoint]
|
|
134
|
+
...
|
|
135
|
+
```
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## Context Budget Guidelines
|
|
139
|
+
|
|
140
|
+
| Role | Target Context | Activities |
|
|
141
|
+
|------|---------------|------------|
|
|
142
|
+
| Orchestrator | <30% | Read PRD, spawn agents, read checkpoints |
|
|
143
|
+
| Sub-agent | 100% fresh | Implement ONE task, full context available |
|
|
144
|
+
|
|
145
|
+
## Benefits
|
|
146
|
+
|
|
147
|
+
1. **Orchestrator stays fast** - small context, quick responses
|
|
148
|
+
2. **Sub-agents get full context** - fresh start per task
|
|
149
|
+
3. **Checkpoints preserve state** - handoff without context loss
|
|
150
|
+
4. **Parallel execution possible** - spawn multiple sub-agents
|
|
151
|
+
|
|
152
|
+
## Anti-Patterns
|
|
153
|
+
|
|
154
|
+
❌ Orchestrator implements code directly
|
|
155
|
+
❌ Sub-agent works on multiple tasks
|
|
156
|
+
❌ Skipping checkpoints between tasks
|
|
157
|
+
❌ Loading full PRD into sub-agent (only current task)
|