Orchestration & Routing
Context Detection & Routing
Section titled “Context Detection & Routing”Grace operates across 4 workspaces and integrates with multiple external tools. Upon session entry, Grace detects context signals and routes work to the appropriate system.
Trigger Words
Section titled “Trigger Words”Grace monitors for 12 canonical trigger words that indicate intent:
| Trigger | Intent | System | Examples |
|---|---|---|---|
| VALIDATE | Check unit conformance to SPEC-01 | STRATT | VALIDATE stratt://dev/task/review-code@1.0.0 |
| FINGERPRINT | Compute Blake3 hash (SPEC-02) | STRATT | FINGERPRINT my-task.yaml |
| VERIFY | Check fingerprint tamper detection (SPEC-02) | STRATT | VERIFY my-task.yaml |
| CI | Run full validation pipeline | STRATT | CI stratt://dev/chain/code-review@1.0.0 |
| GATE | Resolve gate checkpoint (SPEC-04) | STRATT | GATE approve <trace-id> |
| COUNCIL | Query council state or gate authority | STRATT | COUNCIL pathfinder agents |
| CAMPAIGN | Marketing trail activation or content generation | Grace Campaigns | CAMPAIGN activate CT-07 MERIDIAN_BUILD |
| TRACE | Execute trace analysis (SPEC-05) | Execution Traces | TRACE quality-delta stratt://dev/task/* |
| IMPACT | Compute blast radius (SPEC-03) | STRATT Graph | IMPACT stratt://dev/role/code-reviewer@1.0.0 |
| PRIMER | Domain extension pipeline | Primer System | PRIMER phase-3 finance domain |
| DOCTRINE | Query or update doctrine definitions | Doctrines | DOCTRINE list methodology |
| ECOSYSTEM | Organization registry or cross-org patterns | Ecosystem | ECOSYSTEM tier active-products |
Context Detection Signal Words
Section titled “Context Detection Signal Words”If trigger words are not explicit, Grace detects context via domain-specific signal words:
STRATT Signals
Section titled “STRATT Signals”| Signal Word | Inferred Intent |
|---|---|
unit, role, rule, task, chain, supply | Unit authoring |
import, dependency, dag, cycle | SPEC-03 graph |
contract, input, output, required | SPEC-01 contract |
status, draft, review, published | Lifecycle (SPEC-01) |
promoted, deprecated, archived | Lifecycle transitions |
Choco HQ Signals
Section titled “Choco HQ Signals”| Signal Word | Inferred Intent |
|---|---|
choco://, contract, requirement, domain, namespace | Documentation engine |
neuro, finance, nutrition, legal, film | Non-core domains |
Grace Ecosystem Signals
Section titled “Grace Ecosystem Signals”| Signal Word | Inferred Intent |
|---|---|
stratt-hq, grace-hq, choco-hq, so1-io, iris-hq | Organization context |
active-core, active-products, scaffolded, archive | Tier classification |
integration, pattern, bridge, resolver | Cross-org patterns |
Failure Mode Signals
Section titled “Failure Mode Signals”| Signal Word | Inferred Intent |
|---|---|
FM-01, FM-02, … FM-09 | Failure mode detection/handling |
tamper, broken, cycle, draft, gate | FM-specific context |
Tool Routing
Section titled “Tool Routing”Grace routes operations to tools based on context:
GitHub CLI (gh)
Section titled “GitHub CLI (gh)”When: source == GitHub Issue AND signal matches STRATT/council
gh issue comment <issue-id> --body "..."gh issue create --title "FM-02: Broken import in registry"gh pr review <pr-id> --approveExamples:
- User files GitHub issue: “VALIDATE this chain”
- Grace routes to:
gh+ STRATT CLI - Posts result as comment
Linear API
Section titled “Linear API”When: source == Linear ticket AND signal matches project task
linear update <issue-id> --status "In Progress"linear comment <issue-id> "Gate approved"Examples:
- User creates Linear ticket: “Gate approval needed for code-reviewer@2.0.0”
- Grace routes to: Linear API + STRATT CLI
- Updates ticket status
STRATT CLI
Section titled “STRATT CLI”When: signal matches VALIDATE, FINGERPRINT, VERIFY, CI, GATE, COUNCIL, IMPACT
bun packages/cli/src/index.ts validate stratt://dev/task/review-code@1.0.0bun packages/cli/src/index.ts fingerprint my-task.yamlbun packages/cli/src/index.ts gate approve <trace-id>bun packages/cli/src/index.ts council pathfinderWorking directory: ~/code/workspace/stratt-hq/
n8n Workflows
Section titled “n8n Workflows”When: signal matches CAMPAIGN or signal matches automation
POST /api/v1/workflows/executepayload: { trigger: "CAMPAIGN", trail: "CT-07" }Examples:
- Campaign activation
- Scheduled trace evaluation
- Ecosystem sync operations
MCP Servers
Section titled “MCP Servers”When: Special protocol operations need external service
| Server | Protocol | Purpose |
|---|---|---|
| n8n | HTTP | Workflow automation, campaign execution |
| iris-hq | Iris | Sprite rendering and web publishing |
| traceo-ai | Trace | Execution trace collection and analysis |
| Linear | Linear | Project management and issue tracking |
| GitHub | Git | Repository operations and PR management |
| Notion | Notion | Documentation and knowledge base |
| Gmail | Gmail | Email integration |
| Google Calendar | GCal | Scheduling and work rhythm |
Cross-Workspace Navigation
Section titled “Cross-Workspace Navigation”Grace coordinates across 4 local workspaces. File paths follow a consistent pattern:
STRATT (stratt-hq)
Section titled “STRATT (stratt-hq)”Base: ~/code/workspace/stratt-hq/
| Resource | Path |
|---|---|
| Unit registry | packages/units/ (organized by domain/type) |
| Schema validation | packages/schema/src/ |
| Fingerprinting | packages/fingerprint/src/ |
| Graph/DAG | packages/graph/src/ |
| CLI | packages/cli/src/ (21 commands) |
| Council configs | councils/{name}/council.yaml (7 councils) |
| Specification | CANONICAL-SERIALISATION-SPEC.md (1,215 lines) |
Choco HQ (choco-hq)
Section titled “Choco HQ (choco-hq)”Base: ~/code/workspace/choco-hq/
| Resource | Path |
|---|---|
| Requirements | contracts/ (organized by domain) |
| Specifications | docs/specs/ |
| Namespaces | namespaces.yaml |
| Services | services/ (integration points) |
Grace (grace-hq)
Section titled “Grace (grace-hq)”Base: ~/code/workspace/grace-hq/
| Resource | Path |
|---|---|
| Agent context | agent/ (8 markdown files) |
| Architecture docs | architecture/ (protocol specs, gap analysis) |
| Automation | automation/ (campaigns, traces, scripts) |
| Config | config/ (ecosystem registry, gate rules, namespaces) |
| Memory | memory/ (session-specific, daily) |
| Learnings | .learnings/ (improvement capture) |
Cho-co (cho-co)
Section titled “Cho-co (cho-co)”Base: ~/code/workspace/cho-co/
| Resource | Path |
|---|---|
| Web frontend | apps/web/ |
| Documentation rendering | apps/docs/ |
| API | apps/api/ |
Decision Logic Tables
Section titled “Decision Logic Tables”Grace uses explicit decision tables for complex routing decisions.
Unit Operation Decision
Section titled “Unit Operation Decision”Question: User is asking about a unit. What should Grace do?
| Status | Question | Action | Next |
|---|---|---|---|
| Given | Is unit in STRATT registry? | Query packages/units/ | Validate |
| Given | Is fingerprint stored? | Load from YAML | Verify |
| Validation | Does unit pass Zod schema? | Run validate CLI | Contract check |
| Validation | Do imports resolve? | Run DAG check | Lifecycle check |
| Validation | Is draft isolation respected? | Check FM-07 rule | Gate check |
| Gate | Does unit require gate approval? | Query council gate authority | Publish |
| Publish | Is transition frozen? | Check 4 gate-required transitions | Gate approval |
| Publish | All checks pass? | Publish to R2 registry | Report success |
Marketing Content Decision
Section titled “Marketing Content Decision”Question: User is requesting marketing content. What should Grace do?
| Input | Question | Action | Next |
|---|---|---|---|
| Campaign trail name | Does trail exist in campaign-engine.md? | Lookup trail definition | Audience |
| Audience register | Who is the target audience? (open source, enterprise, internal) | Load tone/style rules | Content |
| Content type | Heading, body, call-to-action, code example? | Load content templates | Generation |
| Generation | Can content be generated from templates? | Use n8n workflow | Review |
| Review | Does content align with brand? | Compare to guidelines | Publish |
Protected Agent Decision
Section titled “Protected Agent Decision”Question: User is assigning a unit to an agent. Is the agent protected?
| Agent | Council | Protected? | Bypass Rule | Result |
|---|---|---|---|---|
| BECK-02 | Pathfinder | YES | Cannot bypass | Enforce gate if assignment valid |
| LEWIS-06 | Pathfinder | NO | Can bypass with gate | Allow with gate approval |
| EECOM-02 | Hermes | YES | Cannot bypass | Enforce gate if assignment valid |
| … | … | … | … | … |
Failure Mode Decision
Section titled “Failure Mode Decision”Question: Grace detects a failure mode. What is the handler?
| FM Code | Name | Handler | Escalation |
|---|---|---|---|
| FM-01 | Fingerprint Tamper | Reject execution, alert ops | If critical, escalate to Veritas |
| FM-02 | Broken Imports | Validation error, block publish | Request unit repair |
| FM-03 | DAG Cycles | Validation error, block publish | Request refactor |
| FM-04 | Protected Agent Missing | Validation error, block step | Request different agent |
| FM-05 | Gate Removal | Validation error, block transition | Request gate approval |
| FM-06 | Contract Breaking Change | Validation error, block publish | Recommend major version bump |
| FM-07 | Draft Isolation | Validation error, block import | Promote both units to review |
| FM-08 | R2 Infrastructure Failure | Publish fails, rollback | Check infrastructure, retry |
| FM-09 | Capability Check | Validation error, block assignment | Request agent with capability |
Proactive Work Triggers
Section titled “Proactive Work Triggers”Grace watches for conditions that require proactive action (outside normal request/response):
Daily (Active Core Only)
Section titled “Daily (Active Core Only)”- STRATT health check (FM-01, FM-02, FM-04, FM-09, gate queue, council state)
- MERIDIAN build verification
- Session memory backup to long-term memory
Weekly (Active Products)
Section titled “Weekly (Active Products)”- Primer & Neuro domain health
- Choco HQ contract validation
- Integration pattern updates
- Marketing KPI review (HB-01, HB-02, HB-03)
Monthly (Scaffolded)
Section titled “Monthly (Scaffolded)”- Cross-org integration scan
- n8n workflow audit
.learnings/pipeline review
Ad-hoc
Section titled “Ad-hoc”- FM violations detected
- Gate timeouts approaching (24h deadline)
- Campaign milestone reached
Next Steps
Section titled “Next Steps”- Heartbeat & Health: Proactive monitoring and health checks
- Agent Context: The 8 markdown files that define behavior
- Ecosystem: 22 organizations and councils
- Protocol: SPEC-03 DAG and SPEC-04 gates