@cohortapp/agent-sdk 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/commands/init-agent.md +104 -0
- package/.claude/commands/init-maestro.md +1187 -0
- package/.claude/settings.json +161 -0
- package/.env.example +216 -0
- package/README.md +632 -0
- package/agents/browser-operator/agent.md +52 -0
- package/agents/calendar-ops/agent.md +50 -0
- package/agents/communications/agent.md +96 -0
- package/agents/decision-log/agent.md +65 -0
- package/agents/desktop-operator/agent.md +59 -0
- package/agents/gmail-operator/agent.md +62 -0
- package/agents/inbound-dispatcher/agent.md +66 -0
- package/agents/inbox-processor/agent.md +39 -0
- package/agents/pmo-execution/agent.md +60 -0
- package/agents/session-spawner/agent.md +64 -0
- package/agents/slack-operator/agent.md +60 -0
- package/agents/whatsapp-operator/agent.md +60 -0
- package/agents/workflow-automation/agent.md +61 -0
- package/archetypes/altitudes/c-suite.yaml +58 -0
- package/archetypes/altitudes/founder.yaml +68 -0
- package/archetypes/altitudes/senior-manager.yaml +63 -0
- package/archetypes/altitudes/svp.yaml +60 -0
- package/archetypes/altitudes/vp.yaml +50 -0
- package/archetypes/archetype.schema.json +77 -0
- package/archetypes/base.yaml +47 -0
- package/archetypes/capabilities/commercial-leader.yaml +159 -0
- package/archetypes/capabilities/compliance-officer.yaml +159 -0
- package/archetypes/capabilities/executive-operator.yaml +169 -0
- package/archetypes/capabilities/finance-leader.yaml +162 -0
- package/archetypes/capabilities/operations-leader.yaml +154 -0
- package/archetypes/capabilities/product-leader.yaml +148 -0
- package/archetypes/capabilities/technical-leader.yaml +146 -0
- package/archetypes/functions/commercial-leader.yaml +62 -0
- package/archetypes/functions/compliance-officer.yaml +64 -0
- package/archetypes/functions/executive-operator.yaml +70 -0
- package/archetypes/functions/finance-leader.yaml +70 -0
- package/archetypes/functions/operations-leader.yaml +62 -0
- package/archetypes/functions/product-leader.yaml +61 -0
- package/archetypes/functions/technical-leader.yaml +57 -0
- package/bin/cohort-mcp.mjs +81 -0
- package/bin/maestro.mjs +3516 -0
- package/bin/maestro.test.mjs +1015 -0
- package/desktop-control/README.md +56 -0
- package/desktop-control/app-profiles/gmail.yaml +120 -0
- package/desktop-control/app-profiles/slack.yaml +315 -0
- package/desktop-control/app-profiles/whatsapp.yaml +107 -0
- package/docs/architecture/agent-topology.md +2239 -0
- package/docs/architecture/archetype-agent-factory.md +110 -0
- package/docs/architecture/collective-memory-and-org-mesh.md +115 -0
- package/docs/architecture/continuous-monitoring.md +221 -0
- package/docs/architecture/mcp-capability-map.md +585 -0
- package/docs/architecture/system-architecture.md +1272 -0
- package/docs/company-context/README.md +40 -0
- package/docs/guides/agent-persona-setup.md +600 -0
- package/docs/guides/agents-observe-setup.md +64 -0
- package/docs/guides/billing-console-keys.md +88 -0
- package/docs/guides/ccxray-diagnostics.md +65 -0
- package/docs/guides/channel-bus.md +127 -0
- package/docs/guides/claude-mem-setup.md +79 -0
- package/docs/guides/claude-pace-setup.md +56 -0
- package/docs/guides/claudraband-sessions.md +98 -0
- package/docs/guides/clawteam-swarm.md +116 -0
- package/docs/guides/code-review-graph-setup.md +86 -0
- package/docs/guides/email-setup.md +431 -0
- package/docs/guides/mac-mini.md +119 -0
- package/docs/guides/media-generation-setup.md +349 -0
- package/docs/guides/model-routing.md +162 -0
- package/docs/guides/observability-otel.md +265 -0
- package/docs/guides/org-onboarding.md +132 -0
- package/docs/guides/outbound-governance-setup.md +437 -0
- package/docs/guides/pdf-generation-setup.md +315 -0
- package/docs/guides/poller-daemon-setup.md +563 -0
- package/docs/guides/rag-context-setup.md +459 -0
- package/docs/guides/self-optimization-pattern.md +82 -0
- package/docs/guides/setup-wizard.md +178 -0
- package/docs/guides/slack-setup.md +350 -0
- package/docs/guides/telegram-setup.md +227 -0
- package/docs/guides/twilio-subaccounts-setup.md +223 -0
- package/docs/guides/verification.md +128 -0
- package/docs/guides/voice-mode.md +188 -0
- package/docs/guides/voice-sms-setup.md +698 -0
- package/docs/guides/webhook-relay-setup.md +349 -0
- package/docs/guides/whatsapp-setup.md +288 -0
- package/docs/prompts/board-pack-cover-template.md +36 -0
- package/docs/prompts/decision-recommendation-template.md +88 -0
- package/docs/prompts/followup-message-template.md +141 -0
- package/docs/prompts/investor-letter-template.md +52 -0
- package/docs/prompts/morning-brief-template.md +82 -0
- package/docs/prompts/presentation-template.md +58 -0
- package/docs/prompts/weekly-strategic-memo-template.md +104 -0
- package/docs/research/hallucinated-tool-output-investigation.md +151 -0
- package/docs/runbooks/backup-restore.md +205 -0
- package/docs/runbooks/cohort-cutover.md +129 -0
- package/docs/runbooks/fleet-operations.md +200 -0
- package/docs/runbooks/incident-response.md +226 -0
- package/docs/runbooks/mac-mini-bootstrap.md +431 -0
- package/docs/runbooks/perpetual-operations.md +509 -0
- package/docs/runbooks/recovery-and-failover.md +260 -0
- package/framework-features.json +267 -0
- package/ingest/README.md +87 -0
- package/lib/action-executor.js +689 -0
- package/lib/action-executor.test.mjs +871 -0
- package/lib/agent-root.mjs +37 -0
- package/lib/archetype.mjs +236 -0
- package/lib/archetype.test.mjs +132 -0
- package/lib/autonomy.mjs +114 -0
- package/lib/autonomy.test.mjs +66 -0
- package/lib/backlog.mjs +358 -0
- package/lib/backlog.test.mjs +266 -0
- package/lib/budget-guard.mjs +279 -0
- package/lib/budget-guard.test.mjs +291 -0
- package/lib/cadence-bus-schedule.test.mjs +194 -0
- package/lib/cadence-bus.mjs +1120 -0
- package/lib/cadence-bus.test.mjs +720 -0
- package/lib/cadences.mjs +205 -0
- package/lib/cadences.test.mjs +125 -0
- package/lib/capability.mjs +154 -0
- package/lib/capability.test.mjs +78 -0
- package/lib/channels/base-adapter.mjs +719 -0
- package/lib/channels/base-adapter.test.mjs +590 -0
- package/lib/channels/channel.mjs +128 -0
- package/lib/channels/channels.test.mjs +371 -0
- package/lib/channels/contract.mjs +215 -0
- package/lib/channels/contract.test.mjs +137 -0
- package/lib/channels/conversation-resolver.mjs +95 -0
- package/lib/channels/gmail/adapter.mjs +87 -0
- package/lib/channels/inbox-item.mjs +255 -0
- package/lib/channels/inbox-item.test.mjs +335 -0
- package/lib/channels/index.mjs +94 -0
- package/lib/channels/orgmail/adapter.mjs +353 -0
- package/lib/channels/orgmail/adapter.test.mjs +311 -0
- package/lib/channels/pairing.mjs +363 -0
- package/lib/channels/pairing.test.mjs +270 -0
- package/lib/channels/registry.mjs +164 -0
- package/lib/channels/slack/adapter.mjs +317 -0
- package/lib/channels/slack-adapter.test.mjs +212 -0
- package/lib/channels/sms/adapter.mjs +43 -0
- package/lib/channels/telegram/adapter.mjs +432 -0
- package/lib/channels/telegram-adapter.test.mjs +306 -0
- package/lib/channels/voice/adapter.mjs +301 -0
- package/lib/channels/voice/adapter.test.mjs +278 -0
- package/lib/channels/whatsapp/adapter-baileys.mjs +587 -0
- package/lib/channels/whatsapp/adapter-baileys.test.mjs +359 -0
- package/lib/channels/whatsapp/adapter-twilio.mjs +65 -0
- package/lib/channels/whatsapp/baileys-typing.test.mjs +154 -0
- package/lib/charter.mjs +256 -0
- package/lib/charter.test.mjs +89 -0
- package/lib/claude-bin.mjs +134 -0
- package/lib/claude-bin.test.mjs +75 -0
- package/lib/collective/capture.mjs +185 -0
- package/lib/collective/capture.test.mjs +121 -0
- package/lib/collective/cards.mjs +201 -0
- package/lib/collective/cards.test.mjs +114 -0
- package/lib/collective/config.mjs +186 -0
- package/lib/collective/config.test.mjs +123 -0
- package/lib/collective/global-config.mjs +113 -0
- package/lib/collective/global-config.test.mjs +75 -0
- package/lib/collective/presence.mjs +201 -0
- package/lib/collective/presence.test.mjs +95 -0
- package/lib/collective/recall.mjs +215 -0
- package/lib/collective/recall.test.mjs +116 -0
- package/lib/comms/send-gate.mjs +554 -0
- package/lib/comms/send-gate.test.mjs +577 -0
- package/lib/comms.mjs +67 -0
- package/lib/comms.test.mjs +41 -0
- package/lib/diagnostics/alerts.mjs +424 -0
- package/lib/diagnostics/alerts.test.mjs +318 -0
- package/lib/diagnostics/backup-freshness.mjs +188 -0
- package/lib/diagnostics/backup-freshness.test.mjs +185 -0
- package/lib/diagnostics/counters.mjs +269 -0
- package/lib/diagnostics/counters.test.mjs +206 -0
- package/lib/diagnostics/events.mjs +188 -0
- package/lib/diagnostics/events.test.mjs +290 -0
- package/lib/diagnostics/otel.mjs +237 -0
- package/lib/diagnostics/otel.test.mjs +196 -0
- package/lib/diagnostics/trace.mjs +216 -0
- package/lib/diagnostics/trace.test.mjs +251 -0
- package/lib/env-compat.mjs +74 -0
- package/lib/env-compat.test.mjs +104 -0
- package/lib/feature-init.mjs +331 -0
- package/lib/fs-atomic.mjs +112 -0
- package/lib/fs-atomic.test.mjs +72 -0
- package/lib/fs-ownership.mjs +111 -0
- package/lib/fs-ownership.test.mjs +158 -0
- package/lib/hooks/bus.mjs +347 -0
- package/lib/hooks/bus.test.mjs +387 -0
- package/lib/index.js +16 -0
- package/lib/learning/config.mjs +106 -0
- package/lib/learning/config.test.mjs +75 -0
- package/lib/learning/counters.mjs +156 -0
- package/lib/learning/counters.test.mjs +69 -0
- package/lib/learning/curator-consolidate.test.mjs +238 -0
- package/lib/learning/curator.mjs +453 -0
- package/lib/learning/curator.test.mjs +106 -0
- package/lib/learning/log.mjs +40 -0
- package/lib/learning/reflect.mjs +534 -0
- package/lib/learning/reflect.test.mjs +0 -0
- package/lib/learning/session-index.mjs +352 -0
- package/lib/learning/session-index.test.mjs +125 -0
- package/lib/learning/skill-writer.mjs +474 -0
- package/lib/learning/skill-writer.test.mjs +210 -0
- package/lib/mcp/server.mjs +328 -0
- package/lib/mcp/server.test.mjs +400 -0
- package/lib/model-router/auth-profiles.mjs +758 -0
- package/lib/model-router/auth-profiles.test.mjs +580 -0
- package/lib/model-router/catalog/anthropic.yaml +153 -0
- package/lib/model-router/catalog/deepseek.yaml +86 -0
- package/lib/model-router/catalog/moonshot.yaml +81 -0
- package/lib/model-router/catalog/qwen.yaml +114 -0
- package/lib/model-router/catalog.mjs +925 -0
- package/lib/model-router/catalog.test.mjs +385 -0
- package/lib/model-router/economics.mjs +564 -0
- package/lib/model-router/economics.test.mjs +344 -0
- package/lib/model-router/failover.mjs +298 -0
- package/lib/model-router/failover.test.mjs +439 -0
- package/lib/model-router/health.mjs +453 -0
- package/lib/model-router/health.test.mjs +338 -0
- package/lib/model-router/integration-coverage.test.mjs +829 -0
- package/lib/model-router/integration.test.mjs +564 -0
- package/lib/model-router/ledger.mjs +402 -0
- package/lib/model-router/ledger.test.mjs +382 -0
- package/lib/model-router/llm-task.mjs +515 -0
- package/lib/model-router/llm-task.test.mjs +392 -0
- package/lib/model-router/org-credentials.mjs +260 -0
- package/lib/model-router/org-credentials.test.mjs +265 -0
- package/lib/model-router/pricing-refresh.mjs +463 -0
- package/lib/model-router/pricing-refresh.test.mjs +286 -0
- package/lib/model-router/reconcile.mjs +429 -0
- package/lib/model-router/reconcile.test.mjs +316 -0
- package/lib/model-router/repair.mjs +471 -0
- package/lib/model-router/repair.test.mjs +180 -0
- package/lib/model-router/resolve.mjs +1206 -0
- package/lib/model-router/spawn.mjs +497 -0
- package/lib/model-router/spawn.test.mjs +425 -0
- package/lib/model-router/taxonomy.mjs +893 -0
- package/lib/model-router/taxonomy.test.mjs +410 -0
- package/lib/model-router.mjs +677 -0
- package/lib/model-router.test.mjs +907 -0
- package/lib/org/activity.mjs +211 -0
- package/lib/org/activity.test.mjs +134 -0
- package/lib/org/approvals.mjs +448 -0
- package/lib/org/approvals.test.mjs +216 -0
- package/lib/org/awareness.mjs +222 -0
- package/lib/org/awareness.test.mjs +159 -0
- package/lib/org/board.mjs +229 -0
- package/lib/org/board.test.mjs +177 -0
- package/lib/org/bootstrap-context.mjs +169 -0
- package/lib/org/bootstrap-context.test.mjs +153 -0
- package/lib/org/client.mjs +1628 -0
- package/lib/org/client.test.mjs +1107 -0
- package/lib/org/cohort-client.mjs +67 -0
- package/lib/org/cohort-client.test.mjs +126 -0
- package/lib/org/cost-sync.mjs +227 -0
- package/lib/org/cost-sync.test.mjs +153 -0
- package/lib/org/doctor.mjs +212 -0
- package/lib/org/doctor.test.mjs +212 -0
- package/lib/org/handoff.mjs +293 -0
- package/lib/org/handoff.test.mjs +269 -0
- package/lib/org/integration-tools.mjs +182 -0
- package/lib/org/integration-tools.test.mjs +160 -0
- package/lib/org/keys.mjs +131 -0
- package/lib/org/keys.test.mjs +92 -0
- package/lib/org/knowledge.mjs +463 -0
- package/lib/org/knowledge.test.mjs +319 -0
- package/lib/org/leases.mjs +335 -0
- package/lib/org/leases.test.mjs +235 -0
- package/lib/org/mesh-integration.test.mjs +127 -0
- package/lib/org/mesh.mjs +459 -0
- package/lib/org/mesh.test.mjs +345 -0
- package/lib/org/messaging.mjs +503 -0
- package/lib/org/messaging.test.mjs +238 -0
- package/lib/org/policy.mjs +345 -0
- package/lib/org/policy.test.mjs +237 -0
- package/lib/org/protocol.checksum +1 -0
- package/lib/org/protocol.checksum.test.mjs +90 -0
- package/lib/org/protocol.mjs +967 -0
- package/lib/org/protocol.test.mjs +264 -0
- package/lib/org/registry.mjs +194 -0
- package/lib/org/registry.test.mjs +100 -0
- package/lib/org/tool-surface-integration.test.mjs +120 -0
- package/lib/org/tool-surface.mjs +2535 -0
- package/lib/org/tool-surface.test.mjs +589 -0
- package/lib/org/ui-parity.mjs +3236 -0
- package/lib/org/ui-parity.test.mjs +348 -0
- package/lib/org/verify.mjs +176 -0
- package/lib/org/verify.test.mjs +194 -0
- package/lib/rag/embed.mjs +188 -0
- package/lib/rag/indexer.mjs +425 -0
- package/lib/rag/rag.test.mjs +505 -0
- package/lib/rag/search.mjs +475 -0
- package/lib/rate-guard.mjs +246 -0
- package/lib/rate-guard.test.mjs +201 -0
- package/lib/render.mjs +112 -0
- package/lib/render.test.mjs +68 -0
- package/lib/resource-governor.mjs +297 -0
- package/lib/resource-governor.test.mjs +262 -0
- package/lib/scheduling/dynamic-jobs.mjs +675 -0
- package/lib/scheduling/dynamic-jobs.test.mjs +344 -0
- package/lib/scheduling/jitter.mjs +0 -0
- package/lib/scheduling/jitter.test.mjs +140 -0
- package/lib/secrets/broker.mjs +315 -0
- package/lib/secrets/broker.test.mjs +280 -0
- package/lib/secrets/providers.mjs +461 -0
- package/lib/secrets/providers.test.mjs +274 -0
- package/lib/security/audit-engine.mjs +684 -0
- package/lib/security/audit-engine.test.mjs +389 -0
- package/lib/security/coerce-args.mjs +552 -0
- package/lib/security/coerce-args.test.mjs +281 -0
- package/lib/security/dangerous-tools.mjs +97 -0
- package/lib/security/dangerous-tools.test.mjs +68 -0
- package/lib/security/external-content.mjs +145 -0
- package/lib/security/external-content.test.mjs +67 -0
- package/lib/security/redact.mjs +592 -0
- package/lib/security/redact.test.mjs +441 -0
- package/lib/security/secret-equal.mjs +73 -0
- package/lib/security/secret-equal.test.mjs +55 -0
- package/lib/session-permissions.mjs +101 -0
- package/lib/session-permissions.test.mjs +100 -0
- package/lib/setup/claude-probe.mjs +74 -0
- package/lib/setup/completeness.mjs +175 -0
- package/lib/setup/completeness.test.mjs +110 -0
- package/lib/setup/context-pack.mjs +173 -0
- package/lib/setup/context-pack.test.mjs +89 -0
- package/lib/setup/enrich.mjs +277 -0
- package/lib/setup/enrich.test.mjs +115 -0
- package/lib/setup/enroll-from-cohort.mjs +441 -0
- package/lib/setup/enroll-from-cohort.test.mjs +233 -0
- package/lib/setup/integration.test.mjs +162 -0
- package/lib/setup/io.mjs +360 -0
- package/lib/setup/io.test.mjs +77 -0
- package/lib/setup/run-generator.mjs +81 -0
- package/lib/setup/runner.mjs +244 -0
- package/lib/setup/runner.test.mjs +132 -0
- package/lib/setup/sections/comms.mjs +173 -0
- package/lib/setup/sections/company.mjs +120 -0
- package/lib/setup/sections/enrich.mjs +138 -0
- package/lib/setup/sections/identity.mjs +182 -0
- package/lib/setup/sections/identity.test.mjs +140 -0
- package/lib/setup/sections/learning.mjs +153 -0
- package/lib/setup/sections/learning.test.mjs +81 -0
- package/lib/setup/sections/messaging.mjs +219 -0
- package/lib/setup/sections/messaging.test.mjs +127 -0
- package/lib/setup/sections/model.mjs +102 -0
- package/lib/setup/sections/operating-model.mjs +78 -0
- package/lib/setup/sections/org.mjs +475 -0
- package/lib/setup/sections/org.test.mjs +313 -0
- package/lib/setup/sections/orgmail.mjs +173 -0
- package/lib/setup/sections/orgmail.test.mjs +118 -0
- package/lib/setup/sections/recovery.mjs +159 -0
- package/lib/setup/sections/recovery.test.mjs +98 -0
- package/lib/setup/sections/tools.mjs +132 -0
- package/lib/setup/sections/verify.mjs +97 -0
- package/lib/setup/sot.mjs +205 -0
- package/lib/setup/sot.test.mjs +81 -0
- package/lib/setup/state.mjs +151 -0
- package/lib/setup/state.test.mjs +92 -0
- package/lib/singleton.js +229 -0
- package/lib/singleton.test.mjs +135 -0
- package/lib/telemetry/alerts.mjs +216 -0
- package/lib/telemetry/alerts.test.mjs +109 -0
- package/lib/telemetry/collect.mjs +512 -0
- package/lib/telemetry/collect.test.mjs +202 -0
- package/lib/tool-definitions-integration.test.mjs +83 -0
- package/lib/tool-definitions.js +738 -0
- package/lib/tool-definitions.test.mjs +437 -0
- package/lib/util/fetch-timeout.mjs +136 -0
- package/lib/util/fetch-timeout.test.mjs +202 -0
- package/lib/util/reconnect.mjs +343 -0
- package/lib/util/reconnect.test.mjs +369 -0
- package/lib/util/unhandled.mjs +205 -0
- package/lib/util/unhandled.test.mjs +216 -0
- package/lib/voice/context-loader.mjs +466 -0
- package/lib/voice/index.mjs +100 -0
- package/lib/voice/openai-realtime.mjs +510 -0
- package/lib/voice/outbound.mjs +542 -0
- package/lib/voice/outbound.test.mjs +69 -0
- package/lib/voice/post-call-brief.mjs +428 -0
- package/lib/voice/provider.mjs +52 -0
- package/lib/voice/session-rotation.mjs +257 -0
- package/lib/voice/stt.mjs +161 -0
- package/lib/voice/stt.test.mjs +226 -0
- package/lib/voice/tool-bridge.mjs +370 -0
- package/lib/voice/tts.mjs +104 -0
- package/lib/voice/twilio-sip-bridge.mjs +288 -0
- package/lib/voice/voice.test.mjs +990 -0
- package/mcp/README.md +80 -0
- package/package.json +151 -0
- package/plugins/maestro-skills/plugin.json +139 -0
- package/plugins/maestro-skills/skills/agents-observe.md +110 -0
- package/plugins/maestro-skills/skills/board-deck.md +68 -0
- package/plugins/maestro-skills/skills/books-close.md +77 -0
- package/plugins/maestro-skills/skills/brand-steward.md +121 -0
- package/plugins/maestro-skills/skills/calendar-plan.md +57 -0
- package/plugins/maestro-skills/skills/call-working-sessions.md +124 -0
- package/plugins/maestro-skills/skills/ccxray-diagnostics.md +91 -0
- package/plugins/maestro-skills/skills/claude-pace.md +61 -0
- package/plugins/maestro-skills/skills/code-review-graph.md +99 -0
- package/plugins/maestro-skills/skills/crm-pipeline.md +65 -0
- package/plugins/maestro-skills/skills/decision-brief.md +89 -0
- package/plugins/maestro-skills/skills/directory-hygiene.md +125 -0
- package/plugins/maestro-skills/skills/draft-comms.md +84 -0
- package/plugins/maestro-skills/skills/evening-wrap.md +53 -0
- package/plugins/maestro-skills/skills/files-find.md +65 -0
- package/plugins/maestro-skills/skills/generative-ui.md +228 -0
- package/plugins/maestro-skills/skills/hiring-triage.md +74 -0
- package/plugins/maestro-skills/skills/inbox-triage.md +61 -0
- package/plugins/maestro-skills/skills/mail-triage.md +86 -0
- package/plugins/maestro-skills/skills/morning-brief.md +54 -0
- package/plugins/maestro-skills/skills/native-artifacts.md +157 -0
- package/plugins/maestro-skills/skills/org-board.md +133 -0
- package/plugins/maestro-skills/skills/org-credential.md +68 -0
- package/plugins/maestro-skills/skills/org-recall.md +81 -0
- package/plugins/maestro-skills/skills/pipeline-review.md +76 -0
- package/plugins/maestro-skills/skills/regulatory-status.md +81 -0
- package/plugins/maestro-skills/skills/router-why.md +78 -0
- package/plugins/maestro-skills/skills/schedule-meeting.md +91 -0
- package/plugins/maestro-skills/skills/session-search.md +71 -0
- package/plugins/maestro-skills/skills/set-reminder.md +93 -0
- package/plugins/maestro-skills/skills/slack-followup.md +64 -0
- package/plugins/maestro-skills/skills/team-activity.md +86 -0
- package/plugins/maestro-skills/skills/weekly-memo.md +70 -0
- package/policies/action-classification.yaml +114 -0
- package/policies/ai-disclosure.yaml +294 -0
- package/policies/communication-style.md +139 -0
- package/policies/information-barriers.yaml +118 -0
- package/policies/prompt-injection-defence.yaml +138 -0
- package/public/assets/icon-dark.png +0 -0
- package/public/assets/icon-dark.svg +9 -0
- package/public/assets/icon-light.svg +9 -0
- package/public/assets/logo-dark.svg +15 -0
- package/public/assets/logo-light.svg +15 -0
- package/scaffold/.mcp.json +7 -0
- package/scaffold/CLAUDE.md +368 -0
- package/scaffold/config/agent.json +55 -0
- package/scaffold/config/agent.ts +76 -0
- package/scaffold/config/agent.ts.example +89 -0
- package/scaffold/config/alerts.yaml +23 -0
- package/scaffold/config/allowlist.yaml.example +25 -0
- package/scaffold/config/caller-id-map.yaml +46 -0
- package/scaffold/config/collective.yaml +49 -0
- package/scaffold/config/company.json +20 -0
- package/scaffold/config/known-agents.json +6 -0
- package/scaffold/config/learning.yaml +55 -0
- package/scaffold/config/model-routing.yaml.example +104 -0
- package/scaffold/config/org.yaml +25 -0
- package/scaffold/config/orgmail.yaml.example +19 -0
- package/scaffold/config/recovery.yaml +72 -0
- package/scaffold/config/secrets.yaml +27 -0
- package/scaffold/config/slack.yaml.example +35 -0
- package/scaffold/config/telegram.yaml.example +38 -0
- package/scaffold/config/voice.yaml.example +89 -0
- package/scaffold/config/whatsapp.yaml.example +39 -0
- package/schedules/README.md +49 -0
- package/schedules/triggers/backlog-executor.md +102 -0
- package/schedules/triggers/brand-steward.md +72 -0
- package/schedules/triggers/daily-evening-wrap.md +159 -0
- package/schedules/triggers/daily-midday-sweep.md +58 -0
- package/schedules/triggers/daily-morning-brief.md +55 -0
- package/schedules/triggers/directory-hygiene.md +81 -0
- package/schedules/triggers/dynamic-jobs.md +40 -0
- package/schedules/triggers/inbox-processor.md +115 -0
- package/schedules/triggers/meeting-action-capture.md +60 -0
- package/schedules/triggers/meeting-prep.md +69 -0
- package/schedules/triggers/messaging-inbound.md +50 -0
- package/schedules/triggers/org-pulse.md +24 -0
- package/schedules/triggers/quarterly-self-assessment.md +54 -0
- package/schedules/triggers/weekly-engineering-health.md +37 -0
- package/schedules/triggers/weekly-execution.md +65 -0
- package/schedules/triggers/weekly-hiring.md +53 -0
- package/schedules/triggers/weekly-priorities.md +38 -0
- package/schedules/triggers/weekly-strategic-memo.md +124 -0
- package/scripts/archive-email.sh +55 -0
- package/scripts/cadence/cadence-status.mjs +36 -0
- package/scripts/cadence/enqueue-cadence-tick.mjs +174 -0
- package/scripts/cadence/enqueue-cadence-tick.test.mjs +187 -0
- package/scripts/cadence/launchd-cadence-wrapper.sh +85 -0
- package/scripts/cadence/launchd-cloud-relay-wrapper.sh +95 -0
- package/scripts/cadence/launchd-socket-mode-wrapper.sh +95 -0
- package/scripts/ci/check-docs-accuracy.mjs +493 -0
- package/scripts/ci/check-docs-accuracy.test.mjs +409 -0
- package/scripts/ci/check-exports-exist.mjs +140 -0
- package/scripts/ci/check-files-exist.mjs +107 -0
- package/scripts/ci/check-no-build-artifacts.mjs +111 -0
- package/scripts/ci/check-no-build-artifacts.test.mjs +71 -0
- package/scripts/ci/check-no-confidential.mjs +198 -0
- package/scripts/ci/check-no-conflict-markers.mjs +169 -0
- package/scripts/ci/check-no-residual-identity.mjs +163 -0
- package/scripts/ci/check-no-residual-identity.test.mjs +89 -0
- package/scripts/ci/check-tarball-fidelity.mjs +205 -0
- package/scripts/ci/check-unresolved-tokens.mjs +83 -0
- package/scripts/ci/check.mjs +109 -0
- package/scripts/ci/check.test.mjs +194 -0
- package/scripts/ci/run-coverage.mjs +82 -0
- package/scripts/ci/run-tests.mjs +71 -0
- package/scripts/cloud-relay/README.md +59 -0
- package/scripts/cloud-relay/index.mjs +233 -0
- package/scripts/cloud-relay/package.json +15 -0
- package/scripts/cloud-relay/railway.json +13 -0
- package/scripts/cloud-relay/voice/README.md +94 -0
- package/scripts/cloud-relay/voice/package-lock.json +39 -0
- package/scripts/cloud-relay/voice/package.json +16 -0
- package/scripts/cloud-relay/voice/railway.json +13 -0
- package/scripts/cloud-relay/voice/server.mjs +532 -0
- package/scripts/collective/hook-runner.mjs +211 -0
- package/scripts/collective/hook-runner.test.mjs +90 -0
- package/scripts/collective/org-pulse.mjs +72 -0
- package/scripts/collective/org-sync.mjs +61 -0
- package/scripts/collective/recall.mjs +45 -0
- package/scripts/collective/who.mjs +30 -0
- package/scripts/comms-monitor.sh +288 -0
- package/scripts/configure-whatsapp-sandbox.sh +201 -0
- package/scripts/continuous-monitor.sh +91 -0
- package/scripts/cost/fleet-digest.mjs +407 -0
- package/scripts/cost/fleet-digest.test.mjs +207 -0
- package/scripts/cost/track-claude-usage.mjs +169 -0
- package/scripts/daemon/agent-daemon.mjs +989 -0
- package/scripts/daemon/agent-daemon.test.mjs +525 -0
- package/scripts/daemon/cadence-consumer-governance.test.mjs +220 -0
- package/scripts/daemon/cadence-consumer.mjs +1080 -0
- package/scripts/daemon/cadence-consumer.test.mjs +770 -0
- package/scripts/daemon/cadence-handlers.mjs +1121 -0
- package/scripts/daemon/cadence-handlers.test.mjs +617 -0
- package/scripts/daemon/classifier.mjs +704 -0
- package/scripts/daemon/classifier.test.mjs +238 -0
- package/scripts/daemon/classify-kind.mjs +54 -0
- package/scripts/daemon/classify-kind.test.mjs +40 -0
- package/scripts/daemon/context-compiler.mjs +605 -0
- package/scripts/daemon/context-compiler.test.mjs +300 -0
- package/scripts/daemon/dispatcher-cooldown.test.mjs +122 -0
- package/scripts/daemon/dispatcher-governance.test.mjs +886 -0
- package/scripts/daemon/dispatcher.mjs +1516 -0
- package/scripts/daemon/health.mjs +72 -0
- package/scripts/daemon/inbox-deferral.mjs +210 -0
- package/scripts/daemon/inbox-deferral.test.mjs +242 -0
- package/scripts/daemon/integration.test.mjs +149 -0
- package/scripts/daemon/launchd-wrapper-generic.sh +96 -0
- package/scripts/daemon/launchd-wrapper-slack-events.sh +37 -0
- package/scripts/daemon/launchd-wrapper.sh +91 -0
- package/scripts/daemon/lib/session-router.mjs +274 -0
- package/scripts/daemon/lib/session-router.test.mjs +295 -0
- package/scripts/daemon/maestro-daemon.mjs +275 -0
- package/scripts/daemon/prompt-builder.mjs +685 -0
- package/scripts/daemon/prompt-builder.test.mjs +213 -0
- package/scripts/daemon/responder.mjs +854 -0
- package/scripts/daemon/session-lock.mjs +721 -0
- package/scripts/daemon/session-lock.test.mjs +252 -0
- package/scripts/daemon/session-outcomes.mjs +640 -0
- package/scripts/daemon/session-outcomes.test.mjs +533 -0
- package/scripts/daemon/typing-registry.mjs +90 -0
- package/scripts/daemon/typing-registry.test.mjs +77 -0
- package/scripts/daemon/voice-webhook-server.mjs +804 -0
- package/scripts/decisions/capture-decision.mjs +116 -0
- package/scripts/disclosure_assessment.py +873 -0
- package/scripts/disclosure_boundaries.py +562 -0
- package/scripts/email-signature-principal.html +52 -0
- package/scripts/email-signature.html +60 -0
- package/scripts/email_quote_thread.py +167 -0
- package/scripts/email_thread_dedup.py +362 -0
- package/scripts/emergency-stop.sh +81 -0
- package/scripts/healthcheck.sh +116 -0
- package/scripts/hooks/block-mcp-cohort-send.sh +15 -0
- package/scripts/hooks/block-mcp-slack-send.sh +7 -0
- package/scripts/hooks/post-action-log.sh +126 -0
- package/scripts/hooks/pre-send-audit.sh +174 -0
- package/scripts/hooks/pre-send-audit.test.mjs +215 -0
- package/scripts/hooks/session-end-log.sh +27 -0
- package/scripts/hooks/session-start-banner.sh +115 -0
- package/scripts/huddle/audio-bridge.mjs +664 -0
- package/scripts/huddle/boot-slack-cdp.sh +102 -0
- package/scripts/huddle/huddle-controller.mjs +942 -0
- package/scripts/huddle/huddle-server.mjs +1229 -0
- package/scripts/huddle/launch-slack.sh +232 -0
- package/scripts/huddle/openai-realtime-bridge.mjs +462 -0
- package/scripts/huddle/package-lock.json +62 -0
- package/scripts/huddle/package.json +22 -0
- package/scripts/huddle/setup-audio.sh +239 -0
- package/scripts/huddle/start-call.mjs +318 -0
- package/scripts/huddle/test-pipeline.mjs +263 -0
- package/scripts/learning/consolidate-skills.mjs +72 -0
- package/scripts/learning/session-search.mjs +125 -0
- package/scripts/llm_email_dedup.py +442 -0
- package/scripts/local-triggers/generate-plists.sh +432 -0
- package/scripts/local-triggers/generate-plists.test.mjs +413 -0
- package/scripts/local-triggers/install-all.sh +49 -0
- package/scripts/local-triggers/plists/.gitkeep +0 -0
- package/scripts/local-triggers/run-trigger.sh +63 -0
- package/scripts/local-triggers/templates/rag-reindex.plist.template +47 -0
- package/scripts/local-triggers/templates/voice-relay-poller.plist.template +54 -0
- package/scripts/local-triggers/templates/voice-tunnel.plist.template +55 -0
- package/scripts/local-triggers/templates/voice-webhook.plist.template +51 -0
- package/scripts/maintenance/backup-to-cloud.sh +124 -0
- package/scripts/maintenance/health-check.sh +377 -0
- package/scripts/media-generation/README.md +105 -0
- package/scripts/media-generation/gemini-image-client.mjs +173 -0
- package/scripts/media-generation/generate-assets.mjs +289 -0
- package/scripts/media-generation/veo-video-client.mjs +219 -0
- package/scripts/org/send-orgmail.mjs +227 -0
- package/scripts/outbound-dedup-cleanup.sh +43 -0
- package/scripts/outbound-dedup.sh +477 -0
- package/scripts/outbound_dedup.py +115 -0
- package/scripts/parse-voice-transcript.mjs +481 -0
- package/scripts/pdf-generation/README.md +63 -0
- package/scripts/pdf-generation/build-document.mjs +247 -0
- package/scripts/pdf-generation/templates/board-pack.latex +136 -0
- package/scripts/pdf-generation/templates/corporate-letter.latex +126 -0
- package/scripts/pdf-generation/templates/memo.latex +114 -0
- package/scripts/poll-slack-events.sh +35 -0
- package/scripts/poller/calendar-poller.mjs +12 -0
- package/scripts/poller/gmail-poller.mjs +192 -0
- package/scripts/poller/imap-client.mjs +289 -0
- package/scripts/poller/inbox-scan-poller.mjs +156 -0
- package/scripts/poller/inbox-scan-poller.test.mjs +231 -0
- package/scripts/poller/index.mjs +73 -0
- package/scripts/poller/intra-session-check.mjs +285 -0
- package/scripts/poller/lib/cloud-relay-dedup.mjs +88 -0
- package/scripts/poller/lib/cloud-relay-dedup.test.mjs +133 -0
- package/scripts/poller/lib/slash-command-handlers.mjs +177 -0
- package/scripts/poller/secondary-gmail-poller.mjs +132 -0
- package/scripts/poller/slack-cloud-relay-client.mjs +368 -0
- package/scripts/poller/slack-poller.mjs +854 -0
- package/scripts/poller/slack-socket-mode.mjs +917 -0
- package/scripts/poller/slack-socket-mode.test.mjs +753 -0
- package/scripts/poller/trigger.mjs +75 -0
- package/scripts/poller/utils.mjs +371 -0
- package/scripts/poller/voice-cloud-relay-client.mjs +179 -0
- package/scripts/poller/voice-poller.mjs +236 -0
- package/scripts/poller-launchd/install.sh +66 -0
- package/scripts/poller-launchd/poller.plist.template +40 -0
- package/scripts/poller-launchd/whatsapp-handler.plist.template +39 -0
- package/scripts/post-interaction-indexer.py +1598 -0
- package/scripts/pre-draft-context.py +994 -0
- package/scripts/pre_draft_lookup.py +258 -0
- package/scripts/rag/build-index.mjs +47 -0
- package/scripts/rag/ingest.mjs +111 -0
- package/scripts/rag/search.mjs +119 -0
- package/scripts/rag-indexer.py +629 -0
- package/scripts/restore-from-backup.sh +248 -0
- package/scripts/restore-from-backup.test.mjs +178 -0
- package/scripts/resume-operations.sh +80 -0
- package/scripts/search-secondary-inbox.py +181 -0
- package/scripts/secondary-inbox-poller.py +437 -0
- package/scripts/self-optimization/compute-metrics.py +398 -0
- package/scripts/send-email-as-principal.py +369 -0
- package/scripts/send-email-threaded.py +392 -0
- package/scripts/send-email-with-attachment.py +377 -0
- package/scripts/send-email.sh +131 -0
- package/scripts/send-sms.sh +175 -0
- package/scripts/send-whatsapp.sh +292 -0
- package/scripts/session-start.sh +106 -0
- package/scripts/setup/boot-claude-session.sh +94 -0
- package/scripts/setup/configure-macos.sh +674 -0
- package/scripts/setup/configure-twilio-sip-trunk.mjs +207 -0
- package/scripts/setup/configure-voice-tunnel.mjs +182 -0
- package/scripts/setup/generate-agent-env.mjs +92 -0
- package/scripts/setup/generate-agent-package-json.mjs +222 -0
- package/scripts/setup/generate-agent-package-json.test.mjs +143 -0
- package/scripts/setup/generate-autonomy.mjs +60 -0
- package/scripts/setup/generate-backlog.mjs +101 -0
- package/scripts/setup/generate-cadences.mjs +92 -0
- package/scripts/setup/generate-capability.mjs +162 -0
- package/scripts/setup/generate-charter.mjs +76 -0
- package/scripts/setup/generate-comms.mjs +59 -0
- package/scripts/setup/generate-company.mjs +92 -0
- package/scripts/setup/init-agent.sh +547 -0
- package/scripts/setup/init-agent.test.mjs +151 -0
- package/scripts/setup/init-archetype.mjs +74 -0
- package/scripts/setup/init-backup.mjs +54 -0
- package/scripts/setup/init-cadence-bus.mjs +60 -0
- package/scripts/setup/init-channel-bus.mjs +46 -0
- package/scripts/setup/init-cost-tracking.mjs +45 -0
- package/scripts/setup/init-decision-capture.mjs +66 -0
- package/scripts/setup/init-known-agents.mjs +57 -0
- package/scripts/setup/init-learning.mjs +70 -0
- package/scripts/setup/init-memory-executive.mjs +45 -0
- package/scripts/setup/init-model-router.mjs +124 -0
- package/scripts/setup/init-rag.mjs +174 -0
- package/scripts/setup/init-session-router.mjs +38 -0
- package/scripts/setup/init-slack-socket-mode.mjs +260 -0
- package/scripts/setup/init-telegram.mjs +165 -0
- package/scripts/setup/init-voice-realtime.mjs +204 -0
- package/scripts/setup/init-whatsapp-baileys.mjs +77 -0
- package/scripts/setup/install-dev-tools.sh +150 -0
- package/scripts/setup/lib/install-plist.mjs +95 -0
- package/scripts/setup/migrate-agent-to-sot.mjs +192 -0
- package/scripts/setup/render-environment-yaml.mjs +133 -0
- package/scripts/slack-events-ctl.sh +177 -0
- package/scripts/slack-events-server.mjs +1045 -0
- package/scripts/slack-react.mjs +89 -0
- package/scripts/slack-responded.sh +232 -0
- package/scripts/slack-send.sh +287 -0
- package/scripts/slack-typing.mjs +196 -0
- package/scripts/slack-upload-v2.py +95 -0
- package/scripts/sms-handler.mjs +450 -0
- package/scripts/spawn-session.sh +120 -0
- package/scripts/sync-protocol.mjs +217 -0
- package/scripts/system-verify.sh +184 -0
- package/scripts/test-email-thread-dedup.py +239 -0
- package/scripts/test-information-barriers.py +484 -0
- package/scripts/test-llm-email-dedup.py +251 -0
- package/scripts/test-pre-draft-integration.py +203 -0
- package/scripts/test-rag-phase2.sh +442 -0
- package/scripts/test-rag-search.sh +251 -0
- package/scripts/test-voice-parser.mjs +316 -0
- package/scripts/user-context-search.py +659 -0
- package/scripts/validate_outbound.py +1504 -0
- package/scripts/watchdog/ai.maestro.memory-watchdog.plist +41 -0
- package/scripts/watchdog/force-reboot.sh +157 -0
- package/scripts/watchdog/memory-watchdog.sh +473 -0
- package/scripts/whatsapp-handler.mjs +538 -0
- package/teams/desktop-operations.yaml +34 -0
- package/teams/executive-office.yaml +27 -0
- package/teams/legal-and-regulatory.yaml +24 -0
- package/teams/platform-and-engineering.yaml +23 -0
- package/teams/strategy-and-growth.yaml +29 -0
- package/workflows/continuous/backlog-executor.yaml +141 -0
- package/workflows/continuous/inbound-monitor.yaml +168 -0
- package/workflows/daily/applicant-triage.yaml +197 -0
- package/workflows/daily/comms-triage.yaml +80 -0
- package/workflows/daily/evening-wrap.yaml +105 -0
- package/workflows/daily/morning-brief.yaml +164 -0
- package/workflows/daily/slack-followup-sweep.yaml +87 -0
- package/workflows/event-driven/README.md +50 -0
- package/workflows/event-driven/agent-failure-investigation.yaml +137 -0
- package/workflows/event-driven/pr-review.yaml +107 -0
- package/workflows/monthly/board-readiness.yaml +76 -0
- package/workflows/quarterly/strategic-scenario-analysis.yaml +85 -0
- package/workflows/session-protocol.md +171 -0
- package/workflows/weekly/engineering-health.yaml +154 -0
- package/workflows/weekly/hiring-review.yaml +169 -0
- package/workflows/weekly/rollup-pipeline-review.yaml +76 -0
- package/workflows/weekly/strategic-memo.yaml +79 -0
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
# Recovery and Failover Runbook
|
|
2
|
+
|
|
3
|
+
How a Maestro agent recovers from reboots, power loss, memory pressure, rate
|
|
4
|
+
limits, and budget exhaustion — and the short list of cases that still need a
|
|
5
|
+
human. **The design goal (WS4) is self-healing: almost every failure ends in
|
|
6
|
+
"the agent is running again" with no human in the loop.**
|
|
7
|
+
|
|
8
|
+
Two invariants drive everything below:
|
|
9
|
+
|
|
10
|
+
1. **Never brick.** Every automated terminal action ends in the agent running
|
|
11
|
+
again. The **only** thing that permanently stops an agent is a human writing
|
|
12
|
+
`.emergency-stop`. The memory watchdog does **not** write it on OOM.
|
|
13
|
+
2. **Never drop work.** Under pressure, work is **QUEUED** (in memory,
|
|
14
|
+
re-derivable from durable `state/queues/*.yaml`) or **DEFERRED** (left on
|
|
15
|
+
disk). A governor/rate deferral never burns an item's retry budget.
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## 0. Architecture in one paragraph
|
|
20
|
+
|
|
21
|
+
Scheduled work flows through the **cadence bus** (`state/cadence-bus/`): launchd
|
|
22
|
+
plists drop tiny JSON ticks onto `inbox/`; the single persistent daemon
|
|
23
|
+
(`scripts/daemon/maestro-daemon.mjs` → `agent-daemon.mjs` + `cadence-consumer.mjs`)
|
|
24
|
+
drains them, handling each inline or escalating to a managed `claude --print`
|
|
25
|
+
sub-session. Inbound messages flow through the reactive daemon → `dispatcher.mjs`,
|
|
26
|
+
which spawns sessions under a concurrency cap. **There is no separate
|
|
27
|
+
"orchestrator" process** (older runbooks referenced one — it does not exist).
|
|
28
|
+
Recovery is built into these components, not bolted on.
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## 1. Reboot / power-outage recovery (automatic)
|
|
33
|
+
|
|
34
|
+
This is the common case and it is **fully automatic** when the box is set up
|
|
35
|
+
correctly. The recovery chain on boot:
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
power restored / reboot
|
|
39
|
+
└─ pmset autorestart=1 → Mac mini powers back on
|
|
40
|
+
└─ auto-login → user session starts
|
|
41
|
+
└─ RunAtLoad daemon plist → maestro-daemon.mjs starts
|
|
42
|
+
├─ cadence-consumer drains state/cadence-bus/ (events survived on disk)
|
|
43
|
+
├─ agent-daemon sweepBacklog re-scans state/queues/*.yaml (durable)
|
|
44
|
+
├─ scanStaleLocks() + sweepStaleItemClaims() release orphaned claims
|
|
45
|
+
├─ resetActiveSessions({reconcile:true}) re-dispatches mid-flight work
|
|
46
|
+
│ from state/sessions/resume-pending/ via `claude --print --resume`
|
|
47
|
+
└─ missed cadence ticks FAST-FORWARD (one catch-up, not the burst)
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
**Missed ticks are not replayed.** The bus's at-most-once gate
|
|
51
|
+
(`state/cadence-bus/schedule.json`) means an outage spanning N intervals enqueues
|
|
52
|
+
**exactly one** catch-up tick per cadence on the next fire — never a thundering
|
|
53
|
+
herd of N. (Grace window absorbs launchd double-fires; stale fast-forward absorbs
|
|
54
|
+
outages.)
|
|
55
|
+
|
|
56
|
+
**In-flight sessions resume.** Each spawned session writes
|
|
57
|
+
`state/sessions/resume-pending/<sessionId>.json` and deletes it on a clean close.
|
|
58
|
+
A marker still present after a crash means "mid-flight"; on startup the dispatcher
|
|
59
|
+
re-dispatches `claude --print --resume <claudeSessionId>` within a 6h freshness
|
|
60
|
+
window. After **3 strikes** the queue item is set `status: blocked` (so the sweep
|
|
61
|
+
stops re-dispatching it) and an operator can review it — the agent keeps running
|
|
62
|
+
regardless.
|
|
63
|
+
|
|
64
|
+
### One-time host setup (so recovery is automatic)
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
# Reboot automatically after power loss
|
|
68
|
+
sudo pmset -a autorestart 1
|
|
69
|
+
|
|
70
|
+
# Auto-login: System Settings → Users & Groups → Automatic Login → <agent user>
|
|
71
|
+
|
|
72
|
+
# Daemon plist must have RunAtLoad + KeepAlive (generate-plists.sh does this)
|
|
73
|
+
launchctl list | grep ai.maestro
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
`maestro doctor` checks `pmset autorestart`, the watchdog heartbeat, the daemon
|
|
77
|
+
plist, and the recovery markers — run it after any host change.
|
|
78
|
+
|
|
79
|
+
### Verifying after a reboot
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
maestro doctor # heartbeat, plists, governor, budget, pmset
|
|
83
|
+
npm run cadence:status # bus depth + consumer heartbeat
|
|
84
|
+
ls state/sessions/resume-pending/ # should drain to empty as work resumes
|
|
85
|
+
tail -f logs/daemon/$(date +%F)-sessions.jsonl
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## 2. Memory pressure (self-healing, no brick)
|
|
91
|
+
|
|
92
|
+
The memory watchdog (`scripts/watchdog/memory-watchdog.sh`, every 30s via launchd)
|
|
93
|
+
degrades gracefully through escalating tiers. **It never writes `.emergency-stop`.**
|
|
94
|
+
|
|
95
|
+
| Tier | Trigger | Action |
|
|
96
|
+
|---|---|---|
|
|
97
|
+
| **SOFT** | sys 70–80% / claude RSS ≥60% | Write `state/throttle.json` with `ceiling = liveCount-2` (auto-expires in 5 min). The resource governor reads it and admits fewer sessions. **No kills.** |
|
|
98
|
+
| **HARD** | sys 80–90% / claude RSS ≥75% | SIGTERM the youngest/biggest subagents, sparing the oldest "main" session (`MIN_AGE_SECONDS=60`). Lowers the throttle ceiling so freed slots aren't instantly refilled. |
|
|
99
|
+
| **CRITICAL** | sys ≥90%, sustained 2 runs | Clean daemon restart via `launchctl kickstart -k` — the daemon re-reads queues + cooldowns + sweeps claims. **A restart, not a halt.** |
|
|
100
|
+
| **escalation** | >3 failed CRITICAL restarts / 15 min | `force-reboot.sh --graceful` — drains, SIGTERMs claude, reboots. `pmset autorestart` brings the box back (§1). |
|
|
101
|
+
|
|
102
|
+
`state/throttle.json` carries `{ceiling,reason,set_at,expires_at}` with epoch-ms
|
|
103
|
+
timestamps. Because the governor honours `expires_at`, a dead watchdog can't pin
|
|
104
|
+
the throttle — it lifts on its own.
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
scripts/watchdog/memory-watchdog.sh --check # live tiers + throttle state
|
|
108
|
+
cat state/throttle.json 2>/dev/null || echo "no active throttle"
|
|
109
|
+
tail -20 logs/watchdog/$(date +%F)-watchdog.jsonl
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
## 3. The resource governor (never exceed the host, never drop work)
|
|
115
|
+
|
|
116
|
+
`lib/resource-governor.mjs` gates **every** spawn (dispatcher + cadence consumer)
|
|
117
|
+
with one decision:
|
|
118
|
+
|
|
119
|
+
- **ADMIT** — launch now.
|
|
120
|
+
- **QUEUE** — keep it in the in-memory queue (re-derivable from `state/queues/`);
|
|
121
|
+
it spawns when a slot frees.
|
|
122
|
+
- **DEFER** — leave it on disk untouched; the 10-min backlog sweep / next cadence
|
|
123
|
+
tick retries it. **DEFER never calls `failTick` / never burns retry budget.**
|
|
124
|
+
|
|
125
|
+
Dynamic ceiling (replaces the old hardcoded cap):
|
|
126
|
+
`dynamicMax = clamp(floor(totalmem*0.60 / 750MB), 1, min(10, cpus))`, then
|
|
127
|
+
`effectiveMax = min(dynamicMax, throttle.ceiling)`. Thresholds are env-tunable
|
|
128
|
+
(`GOV_*` / `config/recovery.yaml`). Inbox `critical`/`high` work always at least
|
|
129
|
+
QUEUEs and can preempt a running backlog session — **a user message is never
|
|
130
|
+
dropped**.
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
## 4. Rate limits (shared 429 breaker)
|
|
135
|
+
|
|
136
|
+
`lib/rate-guard.mjs` is one shared circuit breaker per provider
|
|
137
|
+
(`state/rate-limits/<provider>.json`). When any spawn source sees a `429` /
|
|
138
|
+
`rate limit` / `overloaded` in a sub-session's stderr it opens the breaker for a
|
|
139
|
+
decorrelated-jitter backoff (`min(15min, rand(1s, lastBackoff*3))`). While open,
|
|
140
|
+
**all** sources gate their spawns (backlog DEFERs, inbox QUEUEs, cadence requeues
|
|
141
|
+
without burning retry budget). A clean session closes the breaker.
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
cat state/rate-limits/anthropic.json 2>/dev/null # openUntil / consecutive429
|
|
145
|
+
maestro doctor | grep -i breaker
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
No action needed — it self-clears. If it's *stuck* open, the provider is likely
|
|
149
|
+
genuinely rate-limiting; wait, or lower concurrency in `config/recovery.yaml`.
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
## 5. Daily budget cap (essential-only, not dark)
|
|
154
|
+
|
|
155
|
+
`lib/budget-guard.mjs` sums today's cost ledger (`state/cost-tracking/<date>.jsonl`)
|
|
156
|
+
against `DAILY_SPEND_CAP_USD` (default $25). One escalating notice fires at
|
|
157
|
+
50 / 75 / 90 %. At **100 %** the governor goes **essential-only**: backlog +
|
|
158
|
+
cadence-escalation work is DEFERRED, **but inbox DMs are still answered** — the
|
|
159
|
+
agent degrades, it doesn't go dark. Resets at UTC midnight.
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
maestro doctor | grep -i budget
|
|
163
|
+
node scripts/cost/track-claude-usage.mjs summarise --days 1
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
Raise the cap in `config/recovery.yaml` (`budget.daily_spend_cap_usd`) or via the
|
|
167
|
+
`DAILY_SPEND_CAP_USD` env var.
|
|
168
|
+
|
|
169
|
+
---
|
|
170
|
+
|
|
171
|
+
## 6. The human kill switch (`.emergency-stop`)
|
|
172
|
+
|
|
173
|
+
`.emergency-stop` at the repo root is the **only** thing that permanently stops an
|
|
174
|
+
agent, and it is **human-only**. When present:
|
|
175
|
+
|
|
176
|
+
- the daemon refuses to start (exits clean so launchd doesn't treadmill),
|
|
177
|
+
- the cadence bus suppresses enqueues (still audited to `queue.jsonl`),
|
|
178
|
+
- the consumer skips all processing.
|
|
179
|
+
|
|
180
|
+
The watchdog, the governor, the rate breaker, and `force-reboot.sh` **never** write
|
|
181
|
+
it. To stop an agent deliberately:
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
npm run emergency-stop # writes .emergency-stop + unloads launchd jobs
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
To resume (the **only** way to clear it):
|
|
188
|
+
|
|
189
|
+
```bash
|
|
190
|
+
scripts/resume-operations.sh # health check → rm .emergency-stop → reload plists
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
`maestro doctor` FAILS while `.emergency-stop` is present, pointing at
|
|
194
|
+
`resume-operations.sh`.
|
|
195
|
+
|
|
196
|
+
---
|
|
197
|
+
|
|
198
|
+
## 7. Manual cadence-bus recovery (rarely needed)
|
|
199
|
+
|
|
200
|
+
The consumer recovers stale claims automatically every 5 min. For an impatient
|
|
201
|
+
operator:
|
|
202
|
+
|
|
203
|
+
```bash
|
|
204
|
+
npm run cadence:status # inbox/claimed/dlq depth + heartbeat age
|
|
205
|
+
|
|
206
|
+
# Force a stale-claim sweep (returns claims >30min to inbox/, or DLQs over budget)
|
|
207
|
+
node -e "import('./lib/cadence-bus.mjs').then(m => console.log(m.recoverStaleClaims(process.cwd())))"
|
|
208
|
+
|
|
209
|
+
# Inspect the dead-letter queue (events past their retry budget)
|
|
210
|
+
ls state/cadence-bus/dlq/
|
|
211
|
+
node scripts/cadence/enqueue-cadence-tick.mjs <cadence> --source=manual --metadata=note=dlq-replay
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
Last-resort bus reset (loses pending ticks; they re-arrive next interval, and the
|
|
215
|
+
at-most-once gate means just one catch-up each):
|
|
216
|
+
|
|
217
|
+
```bash
|
|
218
|
+
ts=$(date -u +%Y-%m-%dT%H-%M-%SZ)
|
|
219
|
+
mkdir -p .maestro/archive/cadence-bus/$ts
|
|
220
|
+
mv state/cadence-bus/{inbox,claimed,dlq} .maestro/archive/cadence-bus/$ts/
|
|
221
|
+
mkdir -p state/cadence-bus/{inbox,claimed,processed,failed,dlq}
|
|
222
|
+
launchctl kickstart -k gui/$(id -u)/ai.maestro.<agent>-daemon
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
---
|
|
226
|
+
|
|
227
|
+
## 8. Cases that still need a human
|
|
228
|
+
|
|
229
|
+
Almost everything self-heals. The genuine human-only cases:
|
|
230
|
+
|
|
231
|
+
1. **Revoked macOS permissions (TCC).** After some OS updates, Accessibility /
|
|
232
|
+
Screen Recording / Automation grants reset. Desktop control fails until
|
|
233
|
+
re-granted in **System Settings → Privacy & Security**. (Headless API/daemon
|
|
234
|
+
work is unaffected.)
|
|
235
|
+
2. **App re-authentication.** Slack / WhatsApp / Gmail device link or OAuth
|
|
236
|
+
expiry needs a manual sign-in (e.g. re-scan the WhatsApp QR, re-auth Gmail).
|
|
237
|
+
3. **A human-set `.emergency-stop`** (§6) — cleared only by
|
|
238
|
+
`resume-operations.sh`.
|
|
239
|
+
4. **Invalid `ANTHROPIC_API_KEY`** in `.env` (401s on every spawn). `maestro
|
|
240
|
+
doctor` flags it; fix the key or set `MAESTRO_PREFER_SUBSCRIPTION_AUTH=1`.
|
|
241
|
+
5. **Disk full / corrupt state YAML** — `maestro doctor` surfaces it; restore the
|
|
242
|
+
file from git history (`git checkout HEAD~1 -- <file>`).
|
|
243
|
+
|
|
244
|
+
---
|
|
245
|
+
|
|
246
|
+
## 9. Post-incident review
|
|
247
|
+
|
|
248
|
+
After a significant incident (agent down >1 hr, wrong comms sent, data loss),
|
|
249
|
+
write a short review to `knowledge/decisions/incidents/{date}-{name}.md` and
|
|
250
|
+
commit: timeline, root cause, impact (workflows missed / comms affected / data
|
|
251
|
+
loss), recovery actions, preventive measures. Update this runbook with anything
|
|
252
|
+
learned.
|
|
253
|
+
|
|
254
|
+
---
|
|
255
|
+
|
|
256
|
+
Related:
|
|
257
|
+
- `docs/runbooks/perpetual-operations.md` — normal operations + monitoring
|
|
258
|
+
- `docs/runbooks/mac-mini-bootstrap.md` — initial host setup
|
|
259
|
+
- `config/recovery.yaml` — all governance/recovery knobs
|
|
260
|
+
- `CLAUDE.md` → "Cadence Bus" — the bus data flow
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://cohortapp.com/schemas/agent-sdk/framework-features.v1.json",
|
|
3
|
+
"schema_version": "1",
|
|
4
|
+
"_doc": "Versioned registry of framework features. Each entry pairs a feature name with its current version, the maestro version that introduced (or last revved) it, and a per-feature init descriptor. `maestro upgrade` reads this file, compares against the agent's .maestro/features.json, and runs `init.command` automatically for features marked `auto: true`. Features with `auto: false` land on the agent's pending-init queue and are surfaced by the SessionStart banner + completed via `maestro init`.",
|
|
5
|
+
"features": {
|
|
6
|
+
"cadence-bus": {
|
|
7
|
+
"version": "1",
|
|
8
|
+
"since": "1.8.0",
|
|
9
|
+
"title": "Cadence bus (persistent main session + lightweight launchd enqueue)",
|
|
10
|
+
"init": {
|
|
11
|
+
"auto": true,
|
|
12
|
+
"command": "node scripts/setup/init-cadence-bus.mjs",
|
|
13
|
+
"description": "Create state/cadence-bus/{inbox,claimed,processed,failed,dlq} + logs/cadence-bus/. Verify daemon plist uses cadence-bus arch."
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"known-agents-registry": {
|
|
17
|
+
"version": "1",
|
|
18
|
+
"since": "1.9.0",
|
|
19
|
+
"title": "Cross-agent registry (peer agent recognition)",
|
|
20
|
+
"init": {
|
|
21
|
+
"auto": true,
|
|
22
|
+
"command": "node scripts/setup/init-known-agents.mjs",
|
|
23
|
+
"description": "Scaffold config/known-agents.json with the Adaptic agent roster so classifier.mjs can detect peer @mentions and avoid responding to messages routed at another agent."
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"memory-executive-scaffold": {
|
|
27
|
+
"version": "1",
|
|
28
|
+
"since": "1.9.0",
|
|
29
|
+
"title": "Executive memory directory structure",
|
|
30
|
+
"init": {
|
|
31
|
+
"auto": true,
|
|
32
|
+
"command": "node scripts/setup/init-memory-executive.mjs",
|
|
33
|
+
"description": "Create memory/executive/ and memory/workstreams/ subdirectories with seed files. Referenced by agents/ceo-briefing/ and skill prompts."
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"inputs-overnight-scaffold": {
|
|
37
|
+
"version": "1",
|
|
38
|
+
"since": "1.9.0",
|
|
39
|
+
"title": "Overnight inputs directory",
|
|
40
|
+
"init": {
|
|
41
|
+
"auto": true,
|
|
42
|
+
"command": "mkdir -p inputs/overnight && [ ! -f inputs/overnight/.gitkeep ] && touch inputs/overnight/.gitkeep || true",
|
|
43
|
+
"description": "Create inputs/overnight/ referenced by morning-brief skill."
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"emergency-stop-paths": {
|
|
47
|
+
"version": "2",
|
|
48
|
+
"since": "1.9.0",
|
|
49
|
+
"title": "Emergency-stop / resume plist path fix",
|
|
50
|
+
"init": {
|
|
51
|
+
"auto": true,
|
|
52
|
+
"command": "true",
|
|
53
|
+
"description": "Cosmetic version bump — emergency-stop.sh and resume-operations.sh now look in ~/Library/LaunchAgents/ instead of $REPO/schedules/. No agent-side init needed; just receive the updated scripts."
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
"rag-foundation": {
|
|
57
|
+
"version": "2",
|
|
58
|
+
"since": "1.12.20",
|
|
59
|
+
"title": "RAG foundation (FTS5 + OpenAI embeddings + hybrid retrieval, hourly reindex)",
|
|
60
|
+
"init": {
|
|
61
|
+
"auto": false,
|
|
62
|
+
"command": "node scripts/setup/init-rag.mjs",
|
|
63
|
+
"description": "Populate config/repo-registry.yaml, install ai.adaptic.<firstname>-rag-reindex.plist (hourly FTS5 refresh), and optionally run an initial build (--build). Requires interactive --yes for repo selection. Indexer at scripts/rag/build-index.mjs walks memory/, knowledge/, state/queues, config/, agents/, workflows/, outputs/, policies/. Hybrid BM25 + cosine-similarity retrieval via lib/rag/search.mjs. Voice sessions pre-load top-3 RAG hits via lib/voice/context-loader.mjs."
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
"decision-capture": {
|
|
67
|
+
"version": "1",
|
|
68
|
+
"since": "1.9.0",
|
|
69
|
+
"title": "Decision capture automation",
|
|
70
|
+
"init": {
|
|
71
|
+
"auto": true,
|
|
72
|
+
"command": "node scripts/setup/init-decision-capture.mjs",
|
|
73
|
+
"description": "Wire knowledge/decisions/ decision-log automation. Post-action hook detects decision-shaped tool calls and surfaces capture prompts. Schema-validated via knowledge/decisions/decision-schema.yaml."
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
"cost-tracking": {
|
|
77
|
+
"version": "1",
|
|
78
|
+
"since": "1.9.0",
|
|
79
|
+
"title": "Cost tracking + quota awareness",
|
|
80
|
+
"init": {
|
|
81
|
+
"auto": true,
|
|
82
|
+
"command": "node scripts/setup/init-cost-tracking.mjs",
|
|
83
|
+
"description": "Set up state/cost-tracking/, scripts/cost/track-claude-usage.mjs, and daily state/dashboards/cost-summary.yaml. Surfaces burn rate in doctor."
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
"session-router": {
|
|
87
|
+
"version": "1",
|
|
88
|
+
"since": "1.9.0",
|
|
89
|
+
"title": "Session router (LRU reuse of long-running Claude sessions)",
|
|
90
|
+
"init": {
|
|
91
|
+
"auto": false,
|
|
92
|
+
"command": "node scripts/setup/init-session-router.mjs",
|
|
93
|
+
"description": "Enable session-router for backlog / inbox processing. Opt-in: requires SESSION_ROUTER_ENABLED=1 in .env. Init wizard helps configure registry path + LRU caps."
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
"backup-replication": {
|
|
97
|
+
"version": "1",
|
|
98
|
+
"since": "1.9.0",
|
|
99
|
+
"title": "Off-machine state backup",
|
|
100
|
+
"init": {
|
|
101
|
+
"auto": false,
|
|
102
|
+
"command": "node scripts/setup/init-backup.mjs",
|
|
103
|
+
"description": "Configure off-machine backup of state/, knowledge/, outputs/, and rotated logs to GCS or S3. Requires bucket name + credentials. Doctor flags if last successful backup is >24h old once configured."
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
"slack-socket-mode": {
|
|
107
|
+
"version": "1",
|
|
108
|
+
"since": "1.10.0",
|
|
109
|
+
"title": "Slack Socket Mode (realtime DM + @mention ingestion)",
|
|
110
|
+
"init": {
|
|
111
|
+
"auto": false,
|
|
112
|
+
"command": "node scripts/setup/init-slack-socket-mode.mjs",
|
|
113
|
+
"description": "Replace the 60s slack-poller cycle with a persistent WebSocket to Slack. Three steps in the Slack admin UI: (1) open the agent's Slack app at api.slack.com/apps; (2) enable Socket Mode and generate an app-level token (xapp-…) with the connections:write scope; (3) enable Event Subscriptions and subscribe to message.channels, message.groups, message.im, message.mpim, and app_mention. The init wizard prompts for the token, appends it to .env, regenerates the launchd plist, and launchctl-loads it. Doctor verifies the token is present, the plist is loaded, and the listener recently connected."
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
"model-router": {
|
|
117
|
+
"version": "1",
|
|
118
|
+
"since": "1.12.0",
|
|
119
|
+
"title": "Model router (cost-optimised LLM routing: Anthropic / Moonshot / Qwen)",
|
|
120
|
+
"init": {
|
|
121
|
+
"auto": true,
|
|
122
|
+
"command": "node scripts/setup/init-model-router.mjs",
|
|
123
|
+
"description": "Place scaffold/config/model-routing.yaml.example at config/model-routing.yaml.disabled so the operator can opt in. Patches .env.example with MOONSHOT_API_KEY and OPENROUTER_API_KEY placeholders. Routes daemon spawns to the cheapest backend that satisfies each request's capability needs while pinning sensitive roles (CEO pre-pass, audit, decision writers) to Anthropic. Inert until the operator renames .disabled → .yaml; the historical Claude-CLI-on-Max-subscription default is preserved verbatim."
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
"voice-realtime": {
|
|
127
|
+
"version": "2",
|
|
128
|
+
"since": "1.12.20",
|
|
129
|
+
"title": "OpenAI Realtime voice (gpt-realtime-2) + Twilio SIP + Railway cloud-relay + outbound Media Streams",
|
|
130
|
+
"init": {
|
|
131
|
+
"auto": false,
|
|
132
|
+
"command": "node scripts/setup/init-voice-realtime.mjs",
|
|
133
|
+
"description": "Full voice stack scaffold: config/voice.yaml, .env.example placeholders (OpenAI/Twilio/Cloud-relay), logs/voice/* dirs, AND ai.adaptic.<firstname>-{voice-webhook,voice-relay-poller}.plist installed in ~/Library/LaunchAgents (auto-booted via launchctl bootstrap). Voice sessions pre-load identity + top queues + recent decisions + today's calendar + team org chart + RAG hits via lib/voice/context-loader.mjs. Inbound goes through Railway-relay (accepts immediately, 750ms poll cadence for WS attach). Outbound goes through Twilio Media Streams via lib/voice/outbound.mjs. Requires interactive Twilio + Railway setup (docs/guides/voice-mode.md)."
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
"channel-bus": {
|
|
137
|
+
"version": "1",
|
|
138
|
+
"since": "1.12.0",
|
|
139
|
+
"title": "Unified channel bus (Slack / WhatsApp / Gmail / Voice via one abstraction)",
|
|
140
|
+
"init": {
|
|
141
|
+
"auto": true,
|
|
142
|
+
"command": "node scripts/setup/init-channel-bus.mjs",
|
|
143
|
+
"description": "Introduce lib/channels/*: a Channel interface, conversation-resolver, and adapter stubs that consolidate Slack/Gmail/WhatsApp/SMS/Voice behind one abstraction. Existing pollers/senders continue to work; the bus is additive. Enables future channel plugins (Discord, Telegram, iMessage) without touching dispatcher.mjs. Inspired by the openclaw plugin SDK."
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
"whatsapp-baileys": {
|
|
147
|
+
"version": "1",
|
|
148
|
+
"since": "1.12.0",
|
|
149
|
+
"title": "WhatsApp via Baileys (multi-modal: media, voice notes, group threads)",
|
|
150
|
+
"init": {
|
|
151
|
+
"auto": false,
|
|
152
|
+
"command": "node scripts/setup/init-whatsapp-baileys.mjs",
|
|
153
|
+
"description": "Optional WhatsApp upgrade path: replace the Twilio webhook adapter with a Baileys-based persistent session. Adds support for media (images, documents, voice notes), quoted-reply threading, group chats, and reactions. Auth state is persisted under state/whatsapp/auth/ via QR-code onboarding. Voice notes are transcribed via Whisper. Twilio adapter remains available for production-critical or compliance-driven deployments."
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
"archetype-library": {
|
|
157
|
+
"version": "1",
|
|
158
|
+
"since": "1.13.0",
|
|
159
|
+
"title": "Function × altitude archetype library (data-driven operating model)",
|
|
160
|
+
"init": {
|
|
161
|
+
"auto": true,
|
|
162
|
+
"command": "node scripts/setup/init-archetype.mjs",
|
|
163
|
+
"description": "Normalise config/agent.json to a { function, altitude } archetype pair (migrating a legacy single-axis `archetype` value to { function: <same>, altitude: c-suite }), then resolve + validate the operating profile via the framework's archetypes/ library (lib/archetype.mjs). Fails closed if the resolved profile is invalid. The resolved profile (towers, decision rights, autonomy bands, KPI tree, backlog streams, comms profile) is the data spine every downstream generator reads — charter, backlog, cadences, capabilities, comms."
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
"self-learning": {
|
|
167
|
+
"version": "1",
|
|
168
|
+
"since": "1.16.0",
|
|
169
|
+
"title": "Self-learning loop (autonomous skill authoring + verbatim session recall)",
|
|
170
|
+
"init": {
|
|
171
|
+
"auto": true,
|
|
172
|
+
"command": "node scripts/setup/init-learning.mjs",
|
|
173
|
+
"description": "Provision the WS3 self-learning loop: config/learning.yaml (from scaffold), state/learning/counters.json (nudge counters), and the state/learning/sessions.db FTS5 transcript store. After each finished session the Stop-hook reflect worker (scripts/collective/hook-runner.mjs) runs Pass A (collective memory cards) then Pass B (lib/learning/reflect.mjs, sonnet) which may autonomously create or patch a flat Claude Code skill under plugins/agent-skills/ — secret-scanned (lib/security/redact) before write and audited to logs/audit/skills.jsonl. A guarded skill-curator cadence ages skills active→stale→archived (lib/learning/curator.mjs) and warms the transcript index. The session-search skill (scripts/learning/session-search.mjs) recalls past sessions verbatim. Tuning lives in config/learning.yaml; the loop is fail-open + silent on non-agent machines. Requires `maestro global-setup` to wire the global hook."
|
|
174
|
+
}
|
|
175
|
+
},
|
|
176
|
+
"org-cohort": {
|
|
177
|
+
"version": "1",
|
|
178
|
+
"since": "1.18.0",
|
|
179
|
+
"title": "Org / Cohort server enrollment (shared knowledge plane + directory)",
|
|
180
|
+
"init": {
|
|
181
|
+
"auto": false,
|
|
182
|
+
"command": "true",
|
|
183
|
+
"description": "Enroll this agent in the org's Cohort knowledge plane. Ships config/org.yaml from scaffold (DISABLED by default — org.cohort.enabled:false, empty base/token), so the agent runs fully standalone until configured. lib/org/* (client/protocol/registry/board/leases/handoff/knowledge/keys/verify/policy/cost-sync/approvals) consume it; the Cohort server itself is services/cohort/. enabled flips true only once base + a bearer token are set. Easiest path: `maestro setup --only org` (captures URL + admin-issued token or pairing code, rewrites config/org.yaml). recall()/remember() are fail-open at runtime — an unreachable or disabled server never blocks the agent."
|
|
184
|
+
}
|
|
185
|
+
},
|
|
186
|
+
"org-credential-broker": {
|
|
187
|
+
"version": "1",
|
|
188
|
+
"since": "1.18.0",
|
|
189
|
+
"title": "Org credential broker (org-managed secret layering)",
|
|
190
|
+
"init": {
|
|
191
|
+
"auto": false,
|
|
192
|
+
"command": "true",
|
|
193
|
+
"description": "Optional: layer org-managed secrets above the local store. lib/secrets/broker.mjs reads config/secrets.yaml broker.{base_url,token_env,identity}; `maestro secrets sync` pulls org secrets into the local provider (fail-closed per secret). Inert until the operator un-comments the broker block in config/secrets.yaml and points it at the org credential broker endpoint (typically the Cohort /secrets binding). No agent-side init beyond receiving the updated config + lib modules on upgrade."
|
|
194
|
+
}
|
|
195
|
+
},
|
|
196
|
+
"secrets-lifecycle": {
|
|
197
|
+
"version": "1",
|
|
198
|
+
"since": "1.18.0",
|
|
199
|
+
"title": "Secret lifecycle (sealed local store + list/rotate/sync)",
|
|
200
|
+
"init": {
|
|
201
|
+
"auto": true,
|
|
202
|
+
"command": "mkdir -p state/secrets logs/audit && true",
|
|
203
|
+
"description": "Ship config/secrets.yaml from scaffold (provider: file by default — an AES-256-GCM-sealed store under state/secrets/.secrets.json keyed by a first-use master key). Surfaces `maestro secrets <list|sync|rotate>`: list prints NAMES only, rotate reads the new value from stdin (never argv), sync pulls from the org broker when configured. Every mutation is audited names-only to logs/audit/secrets.jsonl; values are never logged. lib/secrets/{broker,providers} are the runtime modules."
|
|
204
|
+
}
|
|
205
|
+
},
|
|
206
|
+
"diagnostics-spine": {
|
|
207
|
+
"version": "1",
|
|
208
|
+
"since": "1.18.0",
|
|
209
|
+
"title": "Diagnostics / observability spine (traces, events, counters)",
|
|
210
|
+
"init": {
|
|
211
|
+
"auto": true,
|
|
212
|
+
"command": "mkdir -p logs/diagnostics logs/diagnostics/counters logs/traces logs/events && true",
|
|
213
|
+
"description": "Provision the observability spine: lib/diagnostics/{trace,events,counters,backup-freshness,otel}. Structured traces land under logs/traces/, lifecycle events under logs/events/, daily counters under logs/diagnostics/counters/ (rolled by UTC date). counters feed the alerting evaluator and doctor's cost-telemetry tripwire; backup-freshness flags a stale DR backup; otel is the optional OpenTelemetry bridge (inert unless an OTLP endpoint is set). Fail-open: a write error never blocks the agent."
|
|
214
|
+
}
|
|
215
|
+
},
|
|
216
|
+
"alerting": {
|
|
217
|
+
"version": "1",
|
|
218
|
+
"since": "1.18.0",
|
|
219
|
+
"title": "Behavioral alerting (thresholds + webhook sink)",
|
|
220
|
+
"init": {
|
|
221
|
+
"auto": true,
|
|
222
|
+
"command": "true",
|
|
223
|
+
"description": "Ship config/alerts.yaml from scaffold. The monitoring-alerts cadence evaluates diagnostics counters + today's cost ledger + peer presence + daemon/backup health against the configured thresholds (guardFailSpike, refusalSpike, costPerSessionP99USD, dailySpendWarnUSD, absentAgentSec, daemonHealthStaleSec) and POSTs firing alerts to alerts.webhook (Slack/PagerDuty/Alertmanager-compatible JSON). Omit the webhook to log-only. lib/diagnostics/alerts.mjs is the pure evaluator; unset thresholds fall back to built-in defaults."
|
|
224
|
+
}
|
|
225
|
+
},
|
|
226
|
+
"hook-bus": {
|
|
227
|
+
"version": "1",
|
|
228
|
+
"since": "1.18.0",
|
|
229
|
+
"title": "Hook bus (in-process lifecycle event fan-out)",
|
|
230
|
+
"init": {
|
|
231
|
+
"auto": true,
|
|
232
|
+
"command": "mkdir -p logs/audit/hooks && true",
|
|
233
|
+
"description": "lib/hooks/bus.mjs — a small, fail-open in-process pub/sub that decouples lifecycle producers (send-gate, scheduler, diagnostics, org sync) from subscribers (counters, audit, alerting). Handlers are isolated: one throwing subscriber never derails the emit or the caller. Audited to logs/audit/hooks/. No config; ships with the lib upgrade."
|
|
234
|
+
}
|
|
235
|
+
},
|
|
236
|
+
"dynamic-scheduling": {
|
|
237
|
+
"version": "1",
|
|
238
|
+
"since": "1.18.0",
|
|
239
|
+
"title": "Dynamic scheduling (runtime jobs + jitter)",
|
|
240
|
+
"init": {
|
|
241
|
+
"auto": true,
|
|
242
|
+
"command": "mkdir -p state/scheduling/jobs && true",
|
|
243
|
+
"description": "lib/scheduling/{dynamic-jobs,jitter} — register/cancel one-off and recurring jobs at runtime (persisted under state/scheduling/jobs/) without rewriting launchd plists, and spread enqueue times with decorrelated jitter so fleet ticks don't thunder. Complements the cadence bus (which still owns the fixed launchd cadences). Fail-open: a corrupt job record is skipped, not fatal."
|
|
244
|
+
}
|
|
245
|
+
},
|
|
246
|
+
"send-gate": {
|
|
247
|
+
"version": "1",
|
|
248
|
+
"since": "1.18.0",
|
|
249
|
+
"title": "Outbound send-gate (pre-send policy choke point)",
|
|
250
|
+
"init": {
|
|
251
|
+
"auto": true,
|
|
252
|
+
"command": "true",
|
|
253
|
+
"description": "lib/comms/send-gate.mjs — the single programmatic choke point every outbound message passes through before a channel adapter sends it (banned-phrase / communication-style enforcement, identity-token leak guard, dedupe, rate awareness). Complements the pre-send-audit hook (which gates MCP-driven sends) by covering library-initiated sends. Fail-closed on a hard policy violation, fail-open on evaluator errors so a transient fault never silences the agent."
|
|
254
|
+
}
|
|
255
|
+
},
|
|
256
|
+
"knowledge-plane": {
|
|
257
|
+
"version": "1",
|
|
258
|
+
"since": "1.18.0",
|
|
259
|
+
"title": "Org knowledge plane (recall / remember over the fleet)",
|
|
260
|
+
"init": {
|
|
261
|
+
"auto": false,
|
|
262
|
+
"command": "true",
|
|
263
|
+
"description": "lib/org/knowledge.mjs — recall()/remember() over the org's shared knowledge plane (backed by the Cohort server). Once the agent is enrolled (org-cohort feature: config/org.yaml enabled with base + token), the daemon's prompt-builder can consult recall() so replies are informed by what the fleet already knows, and finished work can remember() durable facts. Server-side ACL governs visibility. Inert + fail-open until enrollment; no standalone init."
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
}
|
package/ingest/README.md
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# Ingestion Pipeline
|
|
2
|
+
|
|
3
|
+
This directory contains configuration and processing artefacts for the Maestro agent's information ingestion pipeline. The pipeline is responsible for incorporating new documents, repository changes, and external information into the knowledge base.
|
|
4
|
+
|
|
5
|
+
## Pipeline Flow
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
Source Identification
|
|
9
|
+
|
|
|
10
|
+
v
|
|
11
|
+
Content Extraction
|
|
12
|
+
|
|
|
13
|
+
v
|
|
14
|
+
Relevance Assessment
|
|
15
|
+
|
|
|
16
|
+
v
|
|
17
|
+
Entity Extraction
|
|
18
|
+
|
|
|
19
|
+
v
|
|
20
|
+
Memory Update
|
|
21
|
+
|
|
|
22
|
+
v
|
|
23
|
+
Synthesis Generation
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### 1. Source Identification
|
|
27
|
+
|
|
28
|
+
New information sources are identified through:
|
|
29
|
+
|
|
30
|
+
- Changes detected in registered source repositories (see `knowledge/sources/source-registry.yaml`)
|
|
31
|
+
- Manual addition of new documents, emails, or meeting notes
|
|
32
|
+
- Alerts from monitored external sources (regulatory updates, market data, news)
|
|
33
|
+
|
|
34
|
+
Each source is validated against the source registry. New sources are evaluated for authority and relevance before being added to the registry.
|
|
35
|
+
|
|
36
|
+
### 2. Content Extraction
|
|
37
|
+
|
|
38
|
+
Raw content is extracted from the source in a structured format:
|
|
39
|
+
|
|
40
|
+
- **Code repositories:** Diffs, new files, commit messages, PR descriptions
|
|
41
|
+
- **Documents:** Full text extraction with metadata (author, date, version)
|
|
42
|
+
- **Emails/communications:** Sender, recipients, subject, body, attachments
|
|
43
|
+
- **Regulatory filings:** Structured fields, requirements, deadlines, conditions
|
|
44
|
+
|
|
45
|
+
### 3. Relevance Assessment
|
|
46
|
+
|
|
47
|
+
Extracted content is evaluated for relevance to active strategic domains:
|
|
48
|
+
|
|
49
|
+
- Scored against active initiatives and open loops in executive memory
|
|
50
|
+
- Classified by domain (regulatory, M&A, technology, fundraising, etc.)
|
|
51
|
+
- Prioritised by urgency and strategic importance
|
|
52
|
+
- Low-relevance items are logged but not promoted to active memory
|
|
53
|
+
|
|
54
|
+
### 4. Entity Extraction
|
|
55
|
+
|
|
56
|
+
Named entities are identified and reconciled against the entity map (`knowledge/entities/entity-map.yaml`):
|
|
57
|
+
|
|
58
|
+
- People, companies, regulators, products, and targets
|
|
59
|
+
- New entities are flagged for addition to the entity map
|
|
60
|
+
- Relationships between entities are captured and updated
|
|
61
|
+
|
|
62
|
+
### 5. Memory Update
|
|
63
|
+
|
|
64
|
+
Relevant information is used to update executive memory (`knowledge/memory/executive-memory.yaml`):
|
|
65
|
+
|
|
66
|
+
- Initiative status changes
|
|
67
|
+
- New open loops or loop closures
|
|
68
|
+
- Relationship updates (new contacts, last-contact dates)
|
|
69
|
+
- Regulatory dependency changes
|
|
70
|
+
- Pipeline progression (fundraising, hiring, rollup targets)
|
|
71
|
+
|
|
72
|
+
### 6. Synthesis Generation
|
|
73
|
+
|
|
74
|
+
Updated information is incorporated into the next scheduled synthesis cycle:
|
|
75
|
+
|
|
76
|
+
- Critical updates trigger immediate digest generation
|
|
77
|
+
- Routine updates are batched into the next daily digest
|
|
78
|
+
- Domain-significant changes are flagged for the next weekly synthesis
|
|
79
|
+
|
|
80
|
+
## Adding New Sources
|
|
81
|
+
|
|
82
|
+
To add a new information source to the pipeline:
|
|
83
|
+
|
|
84
|
+
1. Add an entry to `knowledge/sources/source-registry.yaml` with path, type, domains, and freshness check method.
|
|
85
|
+
2. Run an initial ingestion pass on the source.
|
|
86
|
+
3. Update the entity map with any new entities discovered.
|
|
87
|
+
4. Verify that executive memory reflects any relevant state captured from the new source.
|