macro-agent 0.0.11 → 0.0.13
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/.macro-agent/teams/self-driving/prompts/grinder.md +27 -0
- package/.macro-agent/teams/self-driving/prompts/judge.md +27 -0
- package/.macro-agent/teams/self-driving/prompts/planner.md +33 -0
- package/.macro-agent/teams/self-driving/roles/grinder.yaml +17 -0
- package/.macro-agent/teams/self-driving/roles/judge.yaml +24 -0
- package/.macro-agent/teams/self-driving/roles/planner.yaml +18 -0
- package/.macro-agent/teams/self-driving/team.yaml +103 -0
- package/.macro-agent/teams/structured/prompts/developer.md +26 -0
- package/.macro-agent/teams/structured/prompts/lead.md +25 -0
- package/.macro-agent/teams/structured/prompts/reviewer.md +24 -0
- package/.macro-agent/teams/structured/roles/developer.yaml +12 -0
- package/.macro-agent/teams/structured/roles/lead.yaml +11 -0
- package/.macro-agent/teams/structured/roles/reviewer.yaml +19 -0
- package/.macro-agent/teams/structured/team.yaml +89 -0
- package/.sudocode/issues.jsonl +6 -0
- package/.sudocode/specs.jsonl +7 -0
- package/CLAUDE.md +110 -30
- package/README.md +60 -3
- package/dist/acp/macro-agent.d.ts +4 -0
- package/dist/acp/macro-agent.d.ts.map +1 -1
- package/dist/acp/macro-agent.js +50 -4
- package/dist/acp/macro-agent.js.map +1 -1
- package/dist/acp/session-mapper.d.ts +20 -1
- package/dist/acp/session-mapper.d.ts.map +1 -1
- package/dist/acp/session-mapper.js +90 -1
- package/dist/acp/session-mapper.js.map +1 -1
- package/dist/acp/types.d.ts +24 -1
- package/dist/acp/types.d.ts.map +1 -1
- package/dist/acp/types.js.map +1 -1
- package/dist/agent/agent-manager.d.ts +25 -1
- package/dist/agent/agent-manager.d.ts.map +1 -1
- package/dist/agent/agent-manager.js +93 -7
- package/dist/agent/agent-manager.js.map +1 -1
- package/dist/agent/types.d.ts +22 -0
- package/dist/agent/types.d.ts.map +1 -1
- package/dist/agent/types.js.map +1 -1
- package/dist/agent-detection/command-builder.d.ts +30 -0
- package/dist/agent-detection/command-builder.d.ts.map +1 -0
- package/dist/agent-detection/command-builder.js +71 -0
- package/dist/agent-detection/command-builder.js.map +1 -0
- package/dist/agent-detection/detector.d.ts +84 -0
- package/dist/agent-detection/detector.d.ts.map +1 -0
- package/dist/agent-detection/detector.js +240 -0
- package/dist/agent-detection/detector.js.map +1 -0
- package/dist/agent-detection/index.d.ts +12 -0
- package/dist/agent-detection/index.d.ts.map +1 -0
- package/dist/agent-detection/index.js +14 -0
- package/dist/agent-detection/index.js.map +1 -0
- package/dist/agent-detection/registry.d.ts +53 -0
- package/dist/agent-detection/registry.d.ts.map +1 -0
- package/dist/agent-detection/registry.js +177 -0
- package/dist/agent-detection/registry.js.map +1 -0
- package/dist/agent-detection/types.d.ts +121 -0
- package/dist/agent-detection/types.d.ts.map +1 -0
- package/dist/agent-detection/types.js +20 -0
- package/dist/agent-detection/types.js.map +1 -0
- package/dist/api/server.d.ts.map +1 -1
- package/dist/api/server.js +95 -0
- package/dist/api/server.js.map +1 -1
- package/dist/cli/index.js +29 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/mcp.js +38 -0
- package/dist/cli/mcp.js.map +1 -1
- package/dist/config/index.d.ts +2 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +2 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/project-config.d.ts +46 -0
- package/dist/config/project-config.d.ts.map +1 -0
- package/dist/config/project-config.js +68 -0
- package/dist/config/project-config.js.map +1 -0
- package/dist/lifecycle/cascade.d.ts +1 -1
- package/dist/lifecycle/cascade.d.ts.map +1 -1
- package/dist/lifecycle/handlers/index.d.ts +4 -0
- package/dist/lifecycle/handlers/index.d.ts.map +1 -1
- package/dist/lifecycle/handlers/index.js +2 -0
- package/dist/lifecycle/handlers/index.js.map +1 -1
- package/dist/lifecycle/handlers/worker.d.ts +4 -0
- package/dist/lifecycle/handlers/worker.d.ts.map +1 -1
- package/dist/lifecycle/handlers/worker.js +35 -3
- package/dist/lifecycle/handlers/worker.js.map +1 -1
- package/dist/map/adapter/acp-over-map.d.ts.map +1 -1
- package/dist/map/adapter/acp-over-map.js +32 -2
- package/dist/map/adapter/acp-over-map.js.map +1 -1
- package/dist/map/adapter/event-translator.d.ts.map +1 -1
- package/dist/map/adapter/event-translator.js +1 -0
- package/dist/map/adapter/event-translator.js.map +1 -1
- package/dist/map/adapter/extensions/agent-detection.d.ts +49 -0
- package/dist/map/adapter/extensions/agent-detection.d.ts.map +1 -0
- package/dist/map/adapter/extensions/agent-detection.js +91 -0
- package/dist/map/adapter/extensions/agent-detection.js.map +1 -0
- package/dist/map/adapter/extensions/index.d.ts +10 -1
- package/dist/map/adapter/extensions/index.d.ts.map +1 -1
- package/dist/map/adapter/extensions/index.js +39 -0
- package/dist/map/adapter/extensions/index.js.map +1 -1
- package/dist/map/adapter/extensions/resume.d.ts +47 -0
- package/dist/map/adapter/extensions/resume.d.ts.map +1 -0
- package/dist/map/adapter/extensions/resume.js +59 -0
- package/dist/map/adapter/extensions/resume.js.map +1 -0
- package/dist/map/adapter/extensions/workspace-files.d.ts +42 -0
- package/dist/map/adapter/extensions/workspace-files.d.ts.map +1 -0
- package/dist/map/adapter/extensions/workspace-files.js +338 -0
- package/dist/map/adapter/extensions/workspace-files.js.map +1 -0
- package/dist/mcp/mcp-server.d.ts +6 -0
- package/dist/mcp/mcp-server.d.ts.map +1 -1
- package/dist/mcp/mcp-server.js +45 -0
- package/dist/mcp/mcp-server.js.map +1 -1
- package/dist/mcp/tools/claim_task.d.ts +35 -0
- package/dist/mcp/tools/claim_task.d.ts.map +1 -0
- package/dist/mcp/tools/claim_task.js +58 -0
- package/dist/mcp/tools/claim_task.js.map +1 -0
- package/dist/mcp/tools/done.d.ts +11 -2
- package/dist/mcp/tools/done.d.ts.map +1 -1
- package/dist/mcp/tools/done.js +15 -10
- package/dist/mcp/tools/done.js.map +1 -1
- package/dist/mcp/tools/list_claimable_tasks.d.ts +38 -0
- package/dist/mcp/tools/list_claimable_tasks.d.ts.map +1 -0
- package/dist/mcp/tools/list_claimable_tasks.js +63 -0
- package/dist/mcp/tools/list_claimable_tasks.js.map +1 -0
- package/dist/mcp/tools/unclaim_task.d.ts +31 -0
- package/dist/mcp/tools/unclaim_task.d.ts.map +1 -0
- package/dist/mcp/tools/unclaim_task.js +47 -0
- package/dist/mcp/tools/unclaim_task.js.map +1 -0
- package/dist/metrics/index.d.ts +2 -0
- package/dist/metrics/index.d.ts.map +1 -0
- package/dist/metrics/index.js +2 -0
- package/dist/metrics/index.js.map +1 -0
- package/dist/metrics/metrics.d.ts +79 -0
- package/dist/metrics/metrics.d.ts.map +1 -0
- package/dist/metrics/metrics.js +166 -0
- package/dist/metrics/metrics.js.map +1 -0
- package/dist/roles/capabilities.d.ts +1 -0
- package/dist/roles/capabilities.d.ts.map +1 -1
- package/dist/roles/capabilities.js +3 -0
- package/dist/roles/capabilities.js.map +1 -1
- package/dist/roles/types.d.ts +1 -1
- package/dist/roles/types.d.ts.map +1 -1
- package/dist/router/message-router.d.ts +41 -0
- package/dist/router/message-router.d.ts.map +1 -1
- package/dist/router/message-router.js +136 -5
- package/dist/router/message-router.js.map +1 -1
- package/dist/store/event-store.d.ts +8 -1
- package/dist/store/event-store.d.ts.map +1 -1
- package/dist/store/event-store.js +120 -4
- package/dist/store/event-store.js.map +1 -1
- package/dist/store/types/agents.d.ts +1 -1
- package/dist/store/types/agents.d.ts.map +1 -1
- package/dist/store/types/events.d.ts +1 -1
- package/dist/store/types/events.d.ts.map +1 -1
- package/dist/store/types/events.js.map +1 -1
- package/dist/store/types/index.d.ts +1 -0
- package/dist/store/types/index.d.ts.map +1 -1
- package/dist/store/types/index.js +1 -0
- package/dist/store/types/index.js.map +1 -1
- package/dist/store/types/sessions.d.ts +44 -0
- package/dist/store/types/sessions.d.ts.map +1 -0
- package/dist/store/types/sessions.js +9 -0
- package/dist/store/types/sessions.js.map +1 -0
- package/dist/store/types/tasks.d.ts +2 -0
- package/dist/store/types/tasks.d.ts.map +1 -1
- package/dist/task/backend/memory.d.ts +4 -1
- package/dist/task/backend/memory.d.ts.map +1 -1
- package/dist/task/backend/memory.js +81 -0
- package/dist/task/backend/memory.js.map +1 -1
- package/dist/task/backend/types.d.ts +30 -0
- package/dist/task/backend/types.d.ts.map +1 -1
- package/dist/task/backend/types.js.map +1 -1
- package/dist/teams/index.d.ts +4 -0
- package/dist/teams/index.d.ts.map +1 -0
- package/dist/teams/index.js +4 -0
- package/dist/teams/index.js.map +1 -0
- package/dist/teams/team-loader.d.ts +20 -0
- package/dist/teams/team-loader.d.ts.map +1 -0
- package/dist/teams/team-loader.js +293 -0
- package/dist/teams/team-loader.js.map +1 -0
- package/dist/teams/team-runtime.d.ts +139 -0
- package/dist/teams/team-runtime.d.ts.map +1 -0
- package/dist/teams/team-runtime.js +613 -0
- package/dist/teams/team-runtime.js.map +1 -0
- package/dist/teams/types.d.ts +266 -0
- package/dist/teams/types.d.ts.map +1 -0
- package/dist/teams/types.js +20 -0
- package/dist/teams/types.js.map +1 -0
- package/dist/workspace/dataplane-adapter.d.ts +1 -1
- package/dist/workspace/dataplane-adapter.d.ts.map +1 -1
- package/dist/workspace/dataplane-adapter.js +1 -1
- package/dist/workspace/dataplane-adapter.js.map +1 -1
- package/dist/workspace/index.d.ts +1 -1
- package/dist/workspace/index.d.ts.map +1 -1
- package/dist/workspace/strategies/index.d.ts +6 -0
- package/dist/workspace/strategies/index.d.ts.map +1 -0
- package/dist/workspace/strategies/index.js +5 -0
- package/dist/workspace/strategies/index.js.map +1 -0
- package/dist/workspace/strategies/optimistic.d.ts +26 -0
- package/dist/workspace/strategies/optimistic.d.ts.map +1 -0
- package/dist/workspace/strategies/optimistic.js +121 -0
- package/dist/workspace/strategies/optimistic.js.map +1 -0
- package/dist/workspace/strategies/queue.d.ts +26 -0
- package/dist/workspace/strategies/queue.d.ts.map +1 -0
- package/dist/workspace/strategies/queue.js +67 -0
- package/dist/workspace/strategies/queue.js.map +1 -0
- package/dist/workspace/strategies/registry.d.ts +37 -0
- package/dist/workspace/strategies/registry.d.ts.map +1 -0
- package/dist/workspace/strategies/registry.js +63 -0
- package/dist/workspace/strategies/registry.js.map +1 -0
- package/dist/workspace/strategies/trunk.d.ts +20 -0
- package/dist/workspace/strategies/trunk.d.ts.map +1 -0
- package/dist/workspace/strategies/trunk.js +108 -0
- package/dist/workspace/strategies/trunk.js.map +1 -0
- package/dist/workspace/strategies/types.d.ts +104 -0
- package/dist/workspace/strategies/types.d.ts.map +1 -0
- package/dist/workspace/strategies/types.js +11 -0
- package/dist/workspace/strategies/types.js.map +1 -0
- package/dist/workspace/types.d.ts +1 -1
- package/dist/workspace/types.d.ts.map +1 -1
- package/dist/workspace/workspace-manager.d.ts +1 -1
- package/dist/workspace/workspace-manager.d.ts.map +1 -1
- package/docs/implementation-details.md +1127 -0
- package/docs/implementation-summary.md +448 -0
- package/docs/plan-self-driving-support.md +433 -0
- package/docs/spec-self-driving-support.md +462 -0
- package/docs/team-templates.md +860 -0
- package/docs/teams.md +233 -0
- package/package.json +5 -3
- package/src/acp/__tests__/integration.test.ts +161 -1
- package/src/acp/__tests__/macro-agent.test.ts +95 -0
- package/src/acp/__tests__/session-persistence.test.ts +276 -0
- package/src/acp/macro-agent.ts +79 -7
- package/src/acp/session-mapper.ts +108 -1
- package/src/acp/types.ts +33 -1
- package/src/agent/agent-manager.ts +158 -6
- package/src/agent/types.ts +27 -0
- package/src/agent-detection/__tests__/command-builder.test.ts +336 -0
- package/src/agent-detection/__tests__/detector.test.ts +768 -0
- package/src/agent-detection/__tests__/registry.test.ts +254 -0
- package/src/agent-detection/command-builder.ts +90 -0
- package/src/agent-detection/detector.ts +307 -0
- package/src/agent-detection/index.ts +36 -0
- package/src/agent-detection/registry.ts +200 -0
- package/src/agent-detection/types.ts +184 -0
- package/src/api/server.ts +110 -0
- package/src/cli/index.ts +44 -0
- package/src/cli/mcp.ts +47 -0
- package/src/config/index.ts +9 -0
- package/src/config/project-config.ts +107 -0
- package/src/lifecycle/cascade.ts +1 -1
- package/src/lifecycle/handlers/index.ts +8 -0
- package/src/lifecycle/handlers/worker.ts +48 -3
- package/src/map/adapter/__tests__/extensions.test.ts +359 -0
- package/src/map/adapter/__tests__/workspace-files.test.ts +673 -0
- package/src/map/adapter/acp-over-map.ts +45 -2
- package/src/map/adapter/event-translator.ts +1 -0
- package/src/map/adapter/extensions/agent-detection.ts +201 -0
- package/src/map/adapter/extensions/index.ts +63 -0
- package/src/map/adapter/extensions/resume.ts +114 -0
- package/src/map/adapter/extensions/workspace-files.ts +449 -0
- package/src/mcp/mcp-server.ts +67 -0
- package/src/mcp/tools/claim_task.ts +86 -0
- package/src/mcp/tools/done.ts +24 -10
- package/src/mcp/tools/list_claimable_tasks.ts +93 -0
- package/src/mcp/tools/unclaim_task.ts +71 -0
- package/src/metrics/index.ts +9 -0
- package/src/metrics/metrics.ts +280 -0
- package/src/roles/capabilities.ts +3 -0
- package/src/roles/types.ts +2 -1
- package/src/router/__tests__/message-router.test.ts +561 -0
- package/src/router/message-router.ts +223 -6
- package/src/store/event-store.ts +151 -3
- package/src/store/types/agents.ts +1 -1
- package/src/store/types/events.ts +2 -1
- package/src/store/types/index.ts +1 -0
- package/src/store/types/sessions.ts +53 -0
- package/src/store/types/tasks.ts +3 -0
- package/src/task/backend/memory.ts +116 -0
- package/src/task/backend/types.ts +43 -0
- package/src/teams/__tests__/cross-subsystem.integration.test.ts +983 -0
- package/src/teams/__tests__/e2e/team-runtime.e2e.test.ts +553 -0
- package/src/teams/__tests__/team-system.test.ts +1280 -0
- package/src/teams/index.ts +13 -0
- package/src/teams/team-loader.ts +434 -0
- package/src/teams/team-runtime.ts +727 -0
- package/src/teams/types.ts +377 -0
- package/src/workspace/dataplane-adapter.ts +1 -1
- package/src/workspace/index.ts +1 -1
- package/src/workspace/strategies/index.ts +18 -0
- package/src/workspace/strategies/optimistic.ts +136 -0
- package/src/workspace/strategies/queue.ts +81 -0
- package/src/workspace/strategies/registry.ts +89 -0
- package/src/workspace/strategies/trunk.ts +123 -0
- package/src/workspace/strategies/types.ts +145 -0
- package/src/workspace/types.ts +1 -1
- package/src/workspace/workspace-manager.ts +1 -1
- package/.claude/settings.local.json +0 -59
- package/dist/map/utils/address-translation.d.ts +0 -99
- package/dist/map/utils/address-translation.d.ts.map +0 -1
- package/dist/map/utils/address-translation.js +0 -285
- package/dist/map/utils/address-translation.js.map +0 -1
- package/dist/map/utils/index.d.ts +0 -7
- package/dist/map/utils/index.d.ts.map +0 -1
- package/dist/map/utils/index.js +0 -7
- package/dist/map/utils/index.js.map +0 -1
- package/references/acp-factory-ref/CHANGELOG.md +0 -33
- package/references/acp-factory-ref/LICENSE +0 -21
- package/references/acp-factory-ref/README.md +0 -341
- package/references/acp-factory-ref/package-lock.json +0 -3102
- package/references/acp-factory-ref/package.json +0 -96
- package/references/acp-factory-ref/python/CHANGELOG.md +0 -33
- package/references/acp-factory-ref/python/LICENSE +0 -21
- package/references/acp-factory-ref/python/Makefile +0 -57
- package/references/acp-factory-ref/python/README.md +0 -253
- package/references/acp-factory-ref/python/pyproject.toml +0 -73
- package/references/acp-factory-ref/python/tests/__init__.py +0 -0
- package/references/acp-factory-ref/python/tests/e2e/__init__.py +0 -1
- package/references/acp-factory-ref/python/tests/e2e/test_codex_e2e.py +0 -349
- package/references/acp-factory-ref/python/tests/e2e/test_gemini_e2e.py +0 -165
- package/references/acp-factory-ref/python/tests/e2e/test_opencode_e2e.py +0 -296
- package/references/acp-factory-ref/python/tests/test_client_handler.py +0 -543
- package/references/acp-factory-ref/python/tests/test_pushable.py +0 -199
- package/references/claude-code-acp/.github/workflows/ci.yml +0 -45
- package/references/claude-code-acp/.github/workflows/publish.yml +0 -34
- package/references/claude-code-acp/.prettierrc.json +0 -4
- package/references/claude-code-acp/CHANGELOG.md +0 -249
- package/references/claude-code-acp/LICENSE +0 -222
- package/references/claude-code-acp/README.md +0 -53
- package/references/claude-code-acp/docs/RELEASES.md +0 -24
- package/references/claude-code-acp/eslint.config.js +0 -48
- package/references/claude-code-acp/package-lock.json +0 -4570
- package/references/claude-code-acp/package.json +0 -88
- package/references/claude-code-acp/scripts/release.sh +0 -119
- package/references/claude-code-acp/src/acp-agent.ts +0 -2065
- package/references/claude-code-acp/src/index.ts +0 -26
- package/references/claude-code-acp/src/lib.ts +0 -38
- package/references/claude-code-acp/src/mcp-server.ts +0 -911
- package/references/claude-code-acp/src/settings.ts +0 -522
- package/references/claude-code-acp/src/tests/.claude/commands/quick-math.md +0 -5
- package/references/claude-code-acp/src/tests/.claude/commands/say-hello.md +0 -6
- package/references/claude-code-acp/src/tests/acp-agent-fork.test.ts +0 -479
- package/references/claude-code-acp/src/tests/acp-agent.test.ts +0 -1502
- package/references/claude-code-acp/src/tests/extract-lines.test.ts +0 -103
- package/references/claude-code-acp/src/tests/fork-session.test.ts +0 -335
- package/references/claude-code-acp/src/tests/replace-and-calculate-location.test.ts +0 -334
- package/references/claude-code-acp/src/tests/settings.test.ts +0 -617
- package/references/claude-code-acp/src/tests/skills-options.test.ts +0 -187
- package/references/claude-code-acp/src/tests/tools.test.ts +0 -318
- package/references/claude-code-acp/src/tests/typescript-declarations.test.ts +0 -558
- package/references/claude-code-acp/src/tools.ts +0 -819
- package/references/claude-code-acp/src/utils.ts +0 -171
- package/references/claude-code-acp/tsconfig.json +0 -18
- package/references/claude-code-acp/vitest.config.ts +0 -19
- package/references/multi-agent-protocol/.sudocode/issues.jsonl +0 -111
- package/references/multi-agent-protocol/.sudocode/specs.jsonl +0 -13
- package/references/multi-agent-protocol/LICENSE +0 -21
- package/references/multi-agent-protocol/README.md +0 -113
- package/references/multi-agent-protocol/docs/00-design-specification.md +0 -496
- package/references/multi-agent-protocol/docs/01-open-questions.md +0 -1050
- package/references/multi-agent-protocol/docs/02-wire-protocol.md +0 -296
- package/references/multi-agent-protocol/docs/03-streaming-semantics.md +0 -252
- package/references/multi-agent-protocol/docs/04-error-handling.md +0 -231
- package/references/multi-agent-protocol/docs/05-connection-model.md +0 -244
- package/references/multi-agent-protocol/docs/06-visibility-permissions.md +0 -243
- package/references/multi-agent-protocol/docs/07-federation.md +0 -259
- package/references/multi-agent-protocol/docs/08-macro-agent-migration.md +0 -253
- package/references/multi-agent-protocol/docs/09-authentication.md +0 -680
- package/references/multi-agent-protocol/docs/10-mail-protocol.md +0 -553
- package/references/multi-agent-protocol/docs/agent-iam-integration.md +0 -877
- package/references/multi-agent-protocol/docs/agentic-mesh-integration-draft.md +0 -459
- package/references/multi-agent-protocol/docs/git-transport-draft.md +0 -251
- package/references/multi-agent-protocol/docs-site/Gemfile +0 -22
- package/references/multi-agent-protocol/docs-site/README.md +0 -82
- package/references/multi-agent-protocol/docs-site/_config.yml +0 -91
- package/references/multi-agent-protocol/docs-site/_includes/head_custom.html +0 -20
- package/references/multi-agent-protocol/docs-site/_sass/color_schemes/map.scss +0 -42
- package/references/multi-agent-protocol/docs-site/_sass/custom/custom.scss +0 -34
- package/references/multi-agent-protocol/docs-site/examples/full-integration.md +0 -510
- package/references/multi-agent-protocol/docs-site/examples/index.md +0 -138
- package/references/multi-agent-protocol/docs-site/examples/simple-chat.md +0 -282
- package/references/multi-agent-protocol/docs-site/examples/task-queue.md +0 -399
- package/references/multi-agent-protocol/docs-site/getting-started/index.md +0 -98
- package/references/multi-agent-protocol/docs-site/getting-started/installation.md +0 -219
- package/references/multi-agent-protocol/docs-site/getting-started/overview.md +0 -172
- package/references/multi-agent-protocol/docs-site/getting-started/quickstart.md +0 -237
- package/references/multi-agent-protocol/docs-site/index.md +0 -136
- package/references/multi-agent-protocol/docs-site/protocol/authentication.md +0 -391
- package/references/multi-agent-protocol/docs-site/protocol/connection-model.md +0 -376
- package/references/multi-agent-protocol/docs-site/protocol/design.md +0 -284
- package/references/multi-agent-protocol/docs-site/protocol/error-handling.md +0 -312
- package/references/multi-agent-protocol/docs-site/protocol/federation.md +0 -449
- package/references/multi-agent-protocol/docs-site/protocol/index.md +0 -129
- package/references/multi-agent-protocol/docs-site/protocol/permissions.md +0 -398
- package/references/multi-agent-protocol/docs-site/protocol/streaming.md +0 -353
- package/references/multi-agent-protocol/docs-site/protocol/wire-protocol.md +0 -369
- package/references/multi-agent-protocol/docs-site/sdk/api/agent.md +0 -357
- package/references/multi-agent-protocol/docs-site/sdk/api/client.md +0 -380
- package/references/multi-agent-protocol/docs-site/sdk/api/index.md +0 -62
- package/references/multi-agent-protocol/docs-site/sdk/api/server.md +0 -453
- package/references/multi-agent-protocol/docs-site/sdk/api/types.md +0 -468
- package/references/multi-agent-protocol/docs-site/sdk/guides/agent.md +0 -375
- package/references/multi-agent-protocol/docs-site/sdk/guides/authentication.md +0 -405
- package/references/multi-agent-protocol/docs-site/sdk/guides/client.md +0 -352
- package/references/multi-agent-protocol/docs-site/sdk/guides/index.md +0 -89
- package/references/multi-agent-protocol/docs-site/sdk/guides/server.md +0 -360
- package/references/multi-agent-protocol/docs-site/sdk/guides/testing.md +0 -446
- package/references/multi-agent-protocol/docs-site/sdk/guides/transports.md +0 -363
- package/references/multi-agent-protocol/docs-site/sdk/index.md +0 -206
- package/references/multi-agent-protocol/package-lock.json +0 -3886
- package/references/multi-agent-protocol/package.json +0 -56
- package/references/multi-agent-protocol/schema/meta.json +0 -467
- package/references/multi-agent-protocol/schema/schema.json +0 -2558
|
@@ -0,0 +1,433 @@
|
|
|
1
|
+
# Self-Driving Codebases Support
|
|
2
|
+
|
|
3
|
+
Plan for enabling macro-agent to support Cursor-style autonomous multi-agent workflows through a modular team template layer and a set of new primitives.
|
|
4
|
+
|
|
5
|
+
## Context
|
|
6
|
+
|
|
7
|
+
macro-agent currently provides a structured, correctness-oriented multi-agent orchestration system with four built-in roles (Worker, Integrator, Coordinator, Monitor), workspace isolation via git worktrees, a serialized merge queue, and push-based task assignment.
|
|
8
|
+
|
|
9
|
+
Cursor's ["Towards Self-Driving Codebases"](https://cursor.com/blog/self-driving-codebases) demonstrates a different paradigm: hundreds of agents running autonomously for weeks, committing directly to trunk, tolerating transient errors, and self-converging without centralized integration gates. Their system uses Planners (continuous exploration + task creation), Workers (pull tasks, grind, push), and Judges (periodic quality evaluation).
|
|
10
|
+
|
|
11
|
+
The goal is to enable macro-agent to support **both** paradigms — the existing structured mode and a self-driving mode — through a modular team template layer and a set of new primitives. macro-agent's core remains role-agnostic; the self-driving patterns are expressed as a loadable team configuration on top.
|
|
12
|
+
|
|
13
|
+
## Goals
|
|
14
|
+
|
|
15
|
+
1. **Team Templates**: A modular system for loading pre-configured agent team structures that define roles, spawn patterns, integration strategies, and coordination protocols — without modifying macro-agent core.
|
|
16
|
+
2. **Task Pull Model**: Primitives for agents to discover and claim available tasks, enabling decoupled planning/execution and elastic scaling.
|
|
17
|
+
3. **Pluggable Integration Strategies**: A strategy interface that the worker done() handler dispatches to, with built-in implementations for merge-queue, trunk-based, and optimistic integration — and the ability to register custom strategies.
|
|
18
|
+
4. **Session Continuations**: Persist agent session history so long-running agents can be resumed across process restarts, enabling multi-day autonomous operation.
|
|
19
|
+
5. **Autonomous Observability**: Metrics primitives for monitoring throughput, error rates, and convergence during long-running multi-agent runs.
|
|
20
|
+
|
|
21
|
+
## Non-Goals
|
|
22
|
+
|
|
23
|
+
- Rewriting the existing role system — team templates compose on top of it
|
|
24
|
+
- Building a full dashboard UI — only the data/API layer
|
|
25
|
+
- Implementing specific team templates beyond one reference "self-driving" template
|
|
26
|
+
- Changing the ACP/process model — session continuations are about history, not in-process agent lifecycle
|
|
27
|
+
- Horizontal scaling across machines — single-machine focus for now
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Design Decisions
|
|
32
|
+
|
|
33
|
+
### D1: Team Templates as Configuration, Not Code
|
|
34
|
+
|
|
35
|
+
Team templates are directories of YAML configuration files that compose roles, define spawn graphs, set integration strategies, and configure coordination protocols. They are loaded by the existing `RoleRegistry` layered config system and a new `TeamLoader`.
|
|
36
|
+
|
|
37
|
+
**Alternatives considered**:
|
|
38
|
+
- **Programmatic API**: Define teams in TypeScript. More flexible but requires code changes for each team shape. Rejected — config is more accessible and shareable.
|
|
39
|
+
- **Single monolithic config**: One file per team. Rejected — doesn't compose well with the existing layered role override system.
|
|
40
|
+
|
|
41
|
+
**Rationale**: The existing `.macro-agent/roles/*.yaml` pattern already supports custom roles with inheritance. Team templates extend this with a `team.yaml` manifest that declares which roles participate, how they're spawned, and what strategies they use. The same role definitions work in both structured and self-driving modes — only the orchestration layer differs.
|
|
42
|
+
|
|
43
|
+
### D2: Task Pull via `claim_task` with Optimistic Locking
|
|
44
|
+
|
|
45
|
+
Add a `claim_task` MCP tool and corresponding `TaskBackend.claim()` method. Workers call `claim_task` with optional filters (status, tags, role). The backend atomically transitions the task from `pending`/`ready` to `assigned` using optimistic locking (compare-and-swap on version/status). If the claim fails (another worker got it), the worker retries or picks a different task.
|
|
46
|
+
|
|
47
|
+
**Alternatives considered**:
|
|
48
|
+
- **Central dispatcher**: A coordinator assigns tasks to workers. This is the current push model — works but creates a bottleneck at scale.
|
|
49
|
+
- **Message-based bidding**: Workers bid on tasks via messages, coordinator selects winner. Too much round-trip overhead for high-throughput scenarios.
|
|
50
|
+
|
|
51
|
+
**Rationale**: Pull-based with optimistic locking is the simplest model that scales. No coordinator bottleneck, no bidding overhead. Workers are autonomous — they claim, execute, and report. The task backend is the only coordination point, and SQLite handles contention well for single-machine deployments.
|
|
52
|
+
|
|
53
|
+
### D3: Integration Strategy as a Pluggable Interface
|
|
54
|
+
|
|
55
|
+
Integration is handled through an `IntegrationStrategy` interface that the worker `done()` handler dispatches to. The interface has a single responsibility: take a worker's completed work and land it on the integration branch.
|
|
56
|
+
|
|
57
|
+
```typescript
|
|
58
|
+
/**
|
|
59
|
+
* Pluggable integration strategy interface.
|
|
60
|
+
*
|
|
61
|
+
* Implementations control how worker changes are landed onto
|
|
62
|
+
* the integration branch. The worker done() handler dispatches
|
|
63
|
+
* to the active strategy instead of hardcoding merge queue logic.
|
|
64
|
+
*/
|
|
65
|
+
interface IntegrationStrategy {
|
|
66
|
+
/** Unique identifier for this strategy */
|
|
67
|
+
readonly name: string;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Land a worker's completed changes onto the integration branch.
|
|
71
|
+
*
|
|
72
|
+
* @returns Result indicating success, conflict, or abandonment
|
|
73
|
+
*/
|
|
74
|
+
land(request: LandRequest): Promise<LandResult>;
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Called when the strategy is initialized for a stream.
|
|
78
|
+
* Opportunity to set up any backing resources (queues, branches, etc).
|
|
79
|
+
*/
|
|
80
|
+
initialize?(streamId: string, config: Record<string, unknown>): Promise<void>;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Called when the strategy is torn down.
|
|
84
|
+
*/
|
|
85
|
+
close?(): Promise<void>;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
interface LandRequest {
|
|
89
|
+
/** Stream (integration branch) this targets */
|
|
90
|
+
streamId: string;
|
|
91
|
+
/** Worker's branch containing changes */
|
|
92
|
+
workerBranch: string;
|
|
93
|
+
/** Target integration branch */
|
|
94
|
+
integrationBranch: string;
|
|
95
|
+
/** ID of the worker agent */
|
|
96
|
+
workerAgentId: string;
|
|
97
|
+
/** Task ID this completes */
|
|
98
|
+
taskId: string;
|
|
99
|
+
/** Workspace path for git operations */
|
|
100
|
+
workspacePath: string;
|
|
101
|
+
/** Strategy-specific options from team config */
|
|
102
|
+
options?: Record<string, unknown>;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
type LandResult =
|
|
106
|
+
| { status: 'landed'; mergeCommit: string }
|
|
107
|
+
| { status: 'conflict'; conflictFiles: string[]; action: 'abandoned' | 'queued_for_resolution' }
|
|
108
|
+
| { status: 'retry_exhausted'; attempts: number }
|
|
109
|
+
| { status: 'failed'; error: string };
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Three built-in implementations, plus support for custom strategies:
|
|
113
|
+
|
|
114
|
+
| Strategy | Class | Behavior |
|
|
115
|
+
|----------|-------|----------|
|
|
116
|
+
| `queue` | `QueueIntegrationStrategy` | Wraps existing `MergeQueueInterface`. Submits merge request to queue; integrator processes serially. Current behavior, no changes. |
|
|
117
|
+
| `trunk` | `TrunkIntegrationStrategy` | Direct push to integration branch. On conflict: rebase and retry up to `maxRetries` times. On exhaustion: `conflictAction` determines abandon vs. resolve. |
|
|
118
|
+
| `optimistic` | `OptimisticIntegrationStrategy` | Push immediately. Emit `validation:requested` event. Background validator checks CI; creates fixup tasks on failure; snapshots green branch on success. |
|
|
119
|
+
| custom | User-provided | Register via `IntegrationStrategyRegistry.register(name, factory)`. Factory receives config from `team.yaml`. |
|
|
120
|
+
|
|
121
|
+
**Alternatives considered**:
|
|
122
|
+
- **Per-agent strategy**: Each worker chooses its integration approach. Rejected — creates unpredictable behavior and merge chaos.
|
|
123
|
+
- **Hardcoded strategy selection via switch/case**: Simpler but not extensible. Rejected — users need to implement custom strategies for their specific CI/CD pipelines.
|
|
124
|
+
- **Hardcoded trunk-only**: Remove merge queue entirely. Rejected — existing users depend on the queue for correctness.
|
|
125
|
+
|
|
126
|
+
**Rationale**: A pluggable interface makes integration strategies a first-class extension point. The `queue` strategy wraps existing behavior with zero changes. The worker `done()` handler becomes simpler — it delegates to `strategy.land()` instead of containing merge queue logic directly. Custom strategies can implement organization-specific workflows (e.g., PR-based integration, CI-gated merge, staging branch promotion).
|
|
127
|
+
|
|
128
|
+
**Integration with worker done() handler**: Today, the worker handler in `src/lifecycle/handlers/worker.ts` directly submits to the merge queue (Step 4, lines ~229-387). This gets replaced with:
|
|
129
|
+
|
|
130
|
+
```typescript
|
|
131
|
+
// Step 4: Land changes via integration strategy
|
|
132
|
+
if (args.status === 'completed' && context.workspacePath) {
|
|
133
|
+
const strategy = deps.integrationStrategy; // injected via WorkerHandlerDeps
|
|
134
|
+
const result = await strategy.land({
|
|
135
|
+
streamId: context.streamId,
|
|
136
|
+
workerBranch: sourceBranch,
|
|
137
|
+
integrationBranch: targetBranch,
|
|
138
|
+
workerAgentId: context.agentId,
|
|
139
|
+
taskId: context.taskId,
|
|
140
|
+
workspacePath: context.workspacePath,
|
|
141
|
+
});
|
|
142
|
+
// Handle result...
|
|
143
|
+
}
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### D4: Session Continuations via Persisted Conversation History
|
|
147
|
+
|
|
148
|
+
Agent session history (the conversation transcript with the LLM) is persisted to the EventStore. When an agent needs to resume (after a crash, timeout, or deliberate pause), a new process is spawned with the prior conversation loaded as context. The agent receives a resume prompt explaining it's continuing a previous session.
|
|
149
|
+
|
|
150
|
+
This is explicitly NOT about keeping a process alive forever. Long-running operation means: work -> pause -> resume -> work -> pause -> resume, potentially across days.
|
|
151
|
+
|
|
152
|
+
**Alternatives considered**:
|
|
153
|
+
- **Keep processes alive**: Run agent processes indefinitely. Rejected — processes crash, machines restart, and context windows fill up. Resumption is more robust than persistence.
|
|
154
|
+
- **Checkpoint-based**: Save structured state (current task, progress, decisions). Rejected — too lossy. The conversation transcript IS the state; structured checkpoints can't capture the nuance of in-flight reasoning.
|
|
155
|
+
|
|
156
|
+
**Rationale**: Long-running agents are about continuing session history, not keeping processes alive. This aligns with how Claude Code already works — sessions can be resumed. We just need to persist the transcript and provide a clean resume mechanism at the macro-agent level.
|
|
157
|
+
|
|
158
|
+
### D5: Observability as EventStore Materialized Views
|
|
159
|
+
|
|
160
|
+
Add new materialized views to the EventStore for autonomous operation metrics:
|
|
161
|
+
- **Throughput view**: commits/hour, tasks completed/hour, tasks created/hour (sliding window)
|
|
162
|
+
- **Health view**: build pass rate, error rate, agent utilization (active/idle/blocked)
|
|
163
|
+
- **Convergence view**: time-to-fix after breakage, conflict frequency
|
|
164
|
+
|
|
165
|
+
These are computed from existing events (spawn, terminate, task status changes, merge events). No new event types needed — just new projections over existing data.
|
|
166
|
+
|
|
167
|
+
**Alternatives considered**:
|
|
168
|
+
- **External metrics system**: Export to Prometheus/Grafana. Rejected for now — adds infrastructure dependency. Can be added later as an adapter.
|
|
169
|
+
- **Per-query computation**: Calculate metrics on demand from raw events. Rejected — too slow for dashboards with thousands of events.
|
|
170
|
+
|
|
171
|
+
**Rationale**: The EventStore already supports materialized views (agent view, task view, message queue). Adding metric views follows the same pattern. The API server can expose these via new endpoints, and a future dashboard can consume them.
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
## Architecture
|
|
176
|
+
|
|
177
|
+
### Team Template System
|
|
178
|
+
|
|
179
|
+
```
|
|
180
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
181
|
+
│ Team Template │
|
|
182
|
+
│ .macro-agent/teams/self-driving/ │
|
|
183
|
+
│ ├── team.yaml # Manifest: roles, strategy, config │
|
|
184
|
+
│ ├── roles/ # Role overrides/extensions │
|
|
185
|
+
│ │ ├── planner.yaml # extends: coordinator │
|
|
186
|
+
│ │ ├── grinder.yaml # extends: worker │
|
|
187
|
+
│ │ └── judge.yaml # extends: monitor │
|
|
188
|
+
│ └── prompts/ # Custom prompt templates │
|
|
189
|
+
│ ├── planner.md │
|
|
190
|
+
│ └── judge.md │
|
|
191
|
+
└───────────────────────────┬─────────────────────────────────┘
|
|
192
|
+
│ TeamLoader.load()
|
|
193
|
+
┌───────────────────────────▼─────────────────────────────────┐
|
|
194
|
+
│ Team Runtime │
|
|
195
|
+
│ - Registers roles into RoleRegistry │
|
|
196
|
+
│ - Selects IntegrationStrategy from registry │
|
|
197
|
+
│ - Sets up task backend with pull/push mode │
|
|
198
|
+
│ - Initializes observability views │
|
|
199
|
+
│ - Provides team-aware system prompt context │
|
|
200
|
+
└───────────────────────────┬─────────────────────────────────┘
|
|
201
|
+
│
|
|
202
|
+
┌───────────────────┼───────────────────┐
|
|
203
|
+
▼ ▼ ▼
|
|
204
|
+
RoleRegistry IntegrationStrategy TaskBackend
|
|
205
|
+
(roles added) Registry (strategy) (claim enabled)
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
### Team Manifest Schema (team.yaml)
|
|
209
|
+
|
|
210
|
+
```yaml
|
|
211
|
+
name: self-driving
|
|
212
|
+
description: "Cursor-style autonomous codebase development"
|
|
213
|
+
version: 1
|
|
214
|
+
|
|
215
|
+
# Roles this team uses (references files in roles/ or built-ins)
|
|
216
|
+
roles:
|
|
217
|
+
- planner # Custom role extending coordinator
|
|
218
|
+
- grinder # Custom role extending worker
|
|
219
|
+
- judge # Custom role extending monitor
|
|
220
|
+
|
|
221
|
+
# How the team bootstraps
|
|
222
|
+
bootstrap:
|
|
223
|
+
root:
|
|
224
|
+
role: planner
|
|
225
|
+
config:
|
|
226
|
+
model: sonnet
|
|
227
|
+
prompt: "prompts/planner.md"
|
|
228
|
+
companions:
|
|
229
|
+
- role: judge
|
|
230
|
+
config:
|
|
231
|
+
model: haiku
|
|
232
|
+
|
|
233
|
+
# Integration strategy for this team
|
|
234
|
+
integration:
|
|
235
|
+
strategy: trunk # queue | trunk | optimistic | <custom-name>
|
|
236
|
+
config: # Passed to strategy.initialize()
|
|
237
|
+
maxRetries: 3
|
|
238
|
+
conflictAction: abandon
|
|
239
|
+
|
|
240
|
+
# Task configuration
|
|
241
|
+
tasks:
|
|
242
|
+
mode: pull # push | pull
|
|
243
|
+
pull:
|
|
244
|
+
idleTimeout: 300
|
|
245
|
+
claimFilters:
|
|
246
|
+
status: [pending]
|
|
247
|
+
maxConcurrentPerAgent: 1
|
|
248
|
+
|
|
249
|
+
# Observability
|
|
250
|
+
observability:
|
|
251
|
+
metricsWindow: 3600
|
|
252
|
+
snapshotInterval: 300
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
### Integration Strategy Architecture
|
|
256
|
+
|
|
257
|
+
```
|
|
258
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
259
|
+
│ Worker done() Handler │
|
|
260
|
+
│ (src/lifecycle/handlers/worker.ts) │
|
|
261
|
+
│ │
|
|
262
|
+
│ Step 4: Land changes │
|
|
263
|
+
│ strategy.land(request) ──────────────────┐ │
|
|
264
|
+
└───────────────────────────────────────────┤ │
|
|
265
|
+
▼ │
|
|
266
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
267
|
+
│ IntegrationStrategyRegistry │
|
|
268
|
+
│ .get(name) → IntegrationStrategy │
|
|
269
|
+
│ .register(name, factory) → void │
|
|
270
|
+
│ │
|
|
271
|
+
│ Built-in: │
|
|
272
|
+
│ ┌──────────────┬──────────────┬────────────────┐ │
|
|
273
|
+
│ │ queue │ trunk │ optimistic │ │
|
|
274
|
+
│ │ │ │ │ │
|
|
275
|
+
│ │ Wraps │ Direct push │ Push + async │ │
|
|
276
|
+
│ │ MergeQueue │ + rebase │ validation │ │
|
|
277
|
+
│ │ Interface │ + retry │ + fixup tasks │ │
|
|
278
|
+
│ └──────────────┴──────────────┴────────────────┘ │
|
|
279
|
+
│ │
|
|
280
|
+
│ Custom: │
|
|
281
|
+
│ ┌────────────────────────────────┐ │
|
|
282
|
+
│ │ pr-based, staging-promote, │ │
|
|
283
|
+
│ │ ci-gated, ... │ │
|
|
284
|
+
│ └────────────────────────────────┘ │
|
|
285
|
+
└─────────────────────────────────────────────────────────────┘
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
### Data Flow: Self-Driving Mode
|
|
289
|
+
|
|
290
|
+
```
|
|
291
|
+
1. Team boots → Planner + Judge spawned
|
|
292
|
+
2. Planner explores codebase → creates tasks in TaskBackend
|
|
293
|
+
3. Planner spawns N workers (or pool auto-scales)
|
|
294
|
+
4. Workers claim tasks (pull model):
|
|
295
|
+
claim_task() → work → commit → strategy.land() → done() → claim_task()
|
|
296
|
+
5. On conflict: strategy-specific handling (rebase+retry for trunk, fixup task for optimistic)
|
|
297
|
+
6. On failure: task marked failed, re-enters pool for retry
|
|
298
|
+
7. Judge runs periodically:
|
|
299
|
+
- Checks build/test status
|
|
300
|
+
- Creates fixup tasks for failures
|
|
301
|
+
- Snapshots "green" state to release branch
|
|
302
|
+
8. Planner monitors progress:
|
|
303
|
+
- Creates new tasks as areas are completed
|
|
304
|
+
- Adjusts priorities based on convergence
|
|
305
|
+
- Spawns/terminates workers based on queue depth
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
---
|
|
309
|
+
|
|
310
|
+
## Affected Code
|
|
311
|
+
|
|
312
|
+
| Area | Files | Change Type |
|
|
313
|
+
|------|-------|-------------|
|
|
314
|
+
| Team system | `src/teams/` (new module) | New: types, loader, runtime |
|
|
315
|
+
| Integration strategies | `src/workspace/strategies/` (new) | New: interface, registry, 3 implementations |
|
|
316
|
+
| Task pull | `src/task/backend/types.ts`, `memory.ts` | Modified: claim(), unclaim(), tags |
|
|
317
|
+
| MCP tools | `src/mcp/tools/` (3 new tools) | New: claim_task, unclaim_task, list_claimable_tasks |
|
|
318
|
+
| Worker lifecycle | `src/lifecycle/handlers/worker.ts` | Modified: dispatch to strategy instead of direct merge queue |
|
|
319
|
+
| Agent manager | `src/agent/agent-manager.ts` | Modified: team context propagation, resume() |
|
|
320
|
+
| System prompts | `src/agent/system-prompt.ts` | Modified: team-aware prompt generation |
|
|
321
|
+
| EventStore | `src/store/` | Modified: session history, metric views |
|
|
322
|
+
| CLI | `src/cli/index.ts` | Modified: --team flag |
|
|
323
|
+
| API | `src/api/server.ts` | Modified: metrics + team status endpoints |
|
|
324
|
+
| Capabilities | `src/roles/capabilities.ts` | Modified: task.claim capability |
|
|
325
|
+
|
|
326
|
+
---
|
|
327
|
+
|
|
328
|
+
## Risks / Trade-offs
|
|
329
|
+
|
|
330
|
+
| Risk | Impact | Mitigation |
|
|
331
|
+
|------|--------|------------|
|
|
332
|
+
| Trunk-based integration can break the build | Workers see broken state, waste tokens | Judge creates fixup tasks quickly; optimistic strategy adds async validation |
|
|
333
|
+
| Task claim contention under high concurrency | Workers waste cycles on failed claims | Randomized backoff; claim with multiple candidates |
|
|
334
|
+
| Session continuations bloat EventStore | Large conversation transcripts stored | Compress transcripts; configurable retention policy |
|
|
335
|
+
| Team templates add configuration complexity | Users confused by two config systems | Clear docs; templates are optional; existing roles still work standalone |
|
|
336
|
+
| Backward compatibility | Existing coordinator/integrator/worker flows break | `queue` strategy is the default; team templates are additive |
|
|
337
|
+
| Custom integration strategies with bugs | Broken landing corrupts integration branch | Strategy receives a sandboxed workspace; failures are recoverable |
|
|
338
|
+
|
|
339
|
+
## Open Questions
|
|
340
|
+
|
|
341
|
+
1. **Should team templates be shareable packages?** (e.g., `npm install @macro-agent/team-self-driving`) — Deferred to future work. Start with local directory convention.
|
|
342
|
+
2. **Should the Judge role have write access to create a "green" branch?** — Yes, but only `git.branch.create` + `git.push` on a specific release branch, not arbitrary write access.
|
|
343
|
+
3. **How much session history should be loaded on resume?** — Start with last N messages (configurable), with option to load full transcript. Context window limits are the practical constraint.
|
|
344
|
+
4. **Should workers in pull mode be able to reject a claimed task?** — Yes, via `unclaim_task` which returns it to `pending`.
|
|
345
|
+
|
|
346
|
+
---
|
|
347
|
+
|
|
348
|
+
## Implementation Phases
|
|
349
|
+
|
|
350
|
+
### Phase 1: Team Template System (Foundation)
|
|
351
|
+
|
|
352
|
+
Everything else builds on this. Delivers the modular team loading layer.
|
|
353
|
+
|
|
354
|
+
- [ ] 1.1 Define `TeamManifest` TypeScript types in `src/teams/types.ts` — covers team.yaml schema: name, description, version, roles, bootstrap, integration, tasks, observability sections
|
|
355
|
+
- [ ] 1.2 Implement `TeamLoader` in `src/teams/team-loader.ts` — reads `.macro-agent/teams/<name>/` directory, parses `team.yaml`, validates schema, reads role YAML files, reads prompt template files
|
|
356
|
+
- [ ] 1.3 Implement `TeamRuntime` in `src/teams/team-runtime.ts` — takes a parsed `TeamManifest` and wires it into the system: registers roles into RoleRegistry, selects integration strategy, sets TaskBackend mode, stores active team state
|
|
357
|
+
- [ ] 1.4 Add team context to `AgentManager.spawn()` — propagate `MACRO_TEAM_NAME`, `MACRO_INTEGRATION_STRATEGY`, `MACRO_TASK_MODE` environment variables; include team section in system prompt generation
|
|
358
|
+
- [ ] 1.5 Add `--team <name>` flag to CLI start command — loads team via TeamLoader, initializes TeamRuntime, then proceeds with existing boot flow
|
|
359
|
+
- [ ] 1.6 Implement team bootstrap — after TeamRuntime initializes, spawn root agent and companion agents per manifest `bootstrap` section
|
|
360
|
+
- [ ] 1.7 Add `GET /api/team` endpoint — returns active team config or `{ active: false }`
|
|
361
|
+
- [ ] 1.8 Write unit tests for TeamLoader (manifest parsing, validation, defaults) and TeamRuntime (role registration, config propagation)
|
|
362
|
+
- [ ] 1.9 Write integration test: load a test team template, verify roles registered, agents spawned with correct env vars and prompts
|
|
363
|
+
- [ ] 1.10 Create reference team template `.macro-agent/teams/self-driving/` with team.yaml, planner/grinder/judge role definitions, and prompt templates
|
|
364
|
+
|
|
365
|
+
### Phase 2: Pluggable Integration Strategies (can parallelize with Phase 3)
|
|
366
|
+
|
|
367
|
+
Depends on: Phase 1 (team template sets `integration.strategy`)
|
|
368
|
+
|
|
369
|
+
- [ ] 2.1 Define `IntegrationStrategy` interface and `LandRequest`/`LandResult` types in `src/workspace/strategies/types.ts`
|
|
370
|
+
- [ ] 2.2 Implement `IntegrationStrategyRegistry` in `src/workspace/strategies/registry.ts` — register/get strategies by name, factory pattern accepting config from team.yaml
|
|
371
|
+
- [ ] 2.3 Implement `QueueIntegrationStrategy` in `src/workspace/strategies/queue.ts` — wraps existing `MergeQueueInterface`, same behavior as current worker done() handler Step 4
|
|
372
|
+
- [ ] 2.4 Implement `TrunkIntegrationStrategy` in `src/workspace/strategies/trunk.ts` — commit, push to integration branch, rebase-and-retry on conflict, max retries, configurable conflict action (abandon/resolve)
|
|
373
|
+
- [ ] 2.5 Implement `OptimisticIntegrationStrategy` in `src/workspace/strategies/optimistic.ts` — push immediately, emit validation request event, background validator logic
|
|
374
|
+
- [ ] 2.6 Refactor worker `done()` handler to dispatch to `IntegrationStrategy.land()` instead of directly using merge queue — add `integrationStrategy` to `WorkerHandlerDeps`
|
|
375
|
+
- [ ] 2.7 Wire strategy selection into `TeamRuntime` — look up strategy by name from registry, initialize with stream config
|
|
376
|
+
- [ ] 2.8 Register built-in strategies in module init — queue, trunk, optimistic available by default
|
|
377
|
+
- [ ] 2.9 Ensure `queue` strategy is backward-compatible default — verify all existing merge queue tests pass unchanged
|
|
378
|
+
- [ ] 2.10 Write unit tests for each strategy (queue passthrough, trunk push/rebase/retry/exhaust, optimistic push/validate/fixup)
|
|
379
|
+
- [ ] 2.11 Write integration test: run workers with each strategy, verify correct landing behavior
|
|
380
|
+
|
|
381
|
+
### Phase 3: Task Pull Model (can parallelize with Phase 2)
|
|
382
|
+
|
|
383
|
+
Depends on: Phase 1 (team template sets `tasks.mode: pull`)
|
|
384
|
+
|
|
385
|
+
- [ ] 3.1 Add `tags` field to task types in `src/task/backend/types.ts` and `src/store/types/tasks.ts`
|
|
386
|
+
- [ ] 3.2 Implement `claim(agentId, filters?)` on `TaskBackend` interface — atomic find-and-assign with optimistic locking
|
|
387
|
+
- [ ] 3.3 Implement `claim()` in `InMemoryTaskBackend` — scan pending tasks matching filters, CAS on status
|
|
388
|
+
- [ ] 3.4 Implement `unclaim(agentId, taskId, reason?)` on `TaskBackend` interface and `InMemoryTaskBackend`
|
|
389
|
+
- [ ] 3.5 Add `task.claim` capability to `src/roles/capabilities.ts` capability-tool map
|
|
390
|
+
- [ ] 3.6 Implement `claim_task` MCP tool in `src/mcp/tools/claim_task.ts` — schema, handler calling TaskBackend.claim(), response formatting
|
|
391
|
+
- [ ] 3.7 Implement `unclaim_task` MCP tool in `src/mcp/tools/unclaim_task.ts`
|
|
392
|
+
- [ ] 3.8 Implement `list_claimable_tasks` MCP tool in `src/mcp/tools/list_claimable_tasks.ts`
|
|
393
|
+
- [ ] 3.9 Register new tools in `src/mcp/mcp-server.ts` with `task.claim` capability gating
|
|
394
|
+
- [ ] 3.10 Modify worker `done()` handler — when task mode is `pull` and status is `completed`, do NOT set `shouldTerminate: true`; allow the worker to continue its claim loop
|
|
395
|
+
- [ ] 3.11 Add idle timeout logic — worker tracks last successful claim time; if idle timeout exceeded, self-terminate with `done({ status: "completed", summary: "idle exit" })`
|
|
396
|
+
- [ ] 3.12 Write unit tests for claim/unclaim (including contention), MCP tools, and pull-mode done handler
|
|
397
|
+
- [ ] 3.13 Write integration test: spawn workers in pull mode, create tasks, verify workers claim and complete them, verify idle timeout termination
|
|
398
|
+
|
|
399
|
+
### Phase 4: Session Continuations
|
|
400
|
+
|
|
401
|
+
Depends on: Phase 1 (team template configures `lifecycle.continuation`)
|
|
402
|
+
|
|
403
|
+
- [ ] 4.1 Define session history event type in `src/store/types/events.ts` — `session_history` event with transcript, message count, token estimate
|
|
404
|
+
- [ ] 4.2 Implement session history storage in EventStore — `storeSessionHistory(agentId, transcript)` and `getSessionHistory(agentId, options?)`
|
|
405
|
+
- [ ] 4.3 Add session history persistence to agent termination flow in `AgentManager.terminate()` — when `lifecycle.continuation` is enabled for the role, persist the transcript
|
|
406
|
+
- [ ] 4.4 Add periodic checkpoint persistence — after each agent tool-call round-trip, persist incremental session state (if continuation enabled)
|
|
407
|
+
- [ ] 4.5 Implement `AgentManager.resume(agentId, options?)` — load session history, apply context window limits, generate resume prompt, spawn new agent process with history as initial context
|
|
408
|
+
- [ ] 4.6 Add `lifecycle.continuation` to `RoleDefinition` type and capability checks
|
|
409
|
+
- [ ] 4.7 Add `continuations` section to team manifest schema and TeamRuntime propagation
|
|
410
|
+
- [ ] 4.8 Write unit tests for session storage/retrieval, context window limiting, resume prompt generation
|
|
411
|
+
- [ ] 4.9 Write integration test: spawn agent, terminate, resume, verify context continuity
|
|
412
|
+
|
|
413
|
+
### Phase 5: Autonomous Observability
|
|
414
|
+
|
|
415
|
+
Depends on: Phase 1 (team template configures `observability`), partially Phases 2+3 (task/commit metrics)
|
|
416
|
+
|
|
417
|
+
- [ ] 5.1 Define metric event types in `src/store/types/events.ts` — `metric.task_completed`, `metric.commit_pushed`, `metric.conflict_detected`
|
|
418
|
+
- [ ] 5.2 Emit metric events from done() handlers, integration strategies, and conflict detection paths
|
|
419
|
+
- [ ] 5.3 Implement throughput materialized view in EventStore — sliding window computation over task and commit metric events
|
|
420
|
+
- [ ] 5.4 Implement utilization materialized view in EventStore — derived from agent state transitions (spawn, claim, done, terminate)
|
|
421
|
+
- [ ] 5.5 Implement error rate materialized view in EventStore — derived from task.failed and conflict events
|
|
422
|
+
- [ ] 5.6 Add `GET /api/metrics/throughput`, `GET /api/metrics/utilization`, `GET /api/metrics/errors` endpoints to API server
|
|
423
|
+
- [ ] 5.7 Write unit tests for each materialized view (window computation, edge cases)
|
|
424
|
+
- [ ] 5.8 Write integration test: run a multi-agent session, query metrics endpoints, verify counts match actual activity
|
|
425
|
+
|
|
426
|
+
### Phase 6: Reference Templates and Documentation
|
|
427
|
+
|
|
428
|
+
Depends on: All previous phases
|
|
429
|
+
|
|
430
|
+
- [ ] 6.1 Finalize the `self-driving` reference team template with tested role definitions and prompts
|
|
431
|
+
- [ ] 6.2 Create a `structured` reference template codifying the existing coordinator/integrator/worker pattern as a team template
|
|
432
|
+
- [ ] 6.3 Add team template documentation to `docs/teams.md` — schema reference, custom strategy guide, how to create custom templates, examples
|
|
433
|
+
- [ ] 6.4 Run end-to-end test with self-driving template: planner creates tasks, workers claim and execute, judge monitors quality, trunk integration, metrics reporting
|