arkaos 4.0.1 → 4.1.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.
Files changed (200) hide show
  1. package/README.md +2 -2
  2. package/VERSION +1 -1
  3. package/arka/SKILL.md +16 -22
  4. package/arka/skills/flow/SKILL.md +108 -234
  5. package/config/claude-agents/eduardo-copy.md +53 -0
  6. package/config/claude-agents/francisca-tech.md +52 -0
  7. package/config/claude-agents/marta-cqo.md +52 -0
  8. package/config/claude-agents/paulo-tech-lead.md +50 -0
  9. package/config/cognition/schedules.yaml +15 -0
  10. package/config/constitution.yaml +17 -21
  11. package/config/hooks/_lib/workflow-classifier.sh +1 -1
  12. package/config/hooks/post-tool-use.sh +40 -539
  13. package/config/hooks/pre-tool-use.sh +32 -281
  14. package/config/hooks/session-start.sh +8 -10
  15. package/config/hooks/stop.sh +30 -425
  16. package/config/hooks/user-prompt-submit.sh +42 -459
  17. package/core/__pycache__/__init__.cpython-312.pyc +0 -0
  18. package/core/cognition/__pycache__/__init__.cpython-312.pyc +0 -0
  19. package/core/cognition/__pycache__/dreaming.cpython-313.pyc +0 -0
  20. package/core/cognition/__pycache__/retrieval.cpython-312.pyc +0 -0
  21. package/core/cognition/capture/__pycache__/__init__.cpython-312.pyc +0 -0
  22. package/core/cognition/capture/__pycache__/store.cpython-312.pyc +0 -0
  23. package/core/cognition/dreaming.py +5 -0
  24. package/core/cognition/insights/__pycache__/__init__.cpython-312.pyc +0 -0
  25. package/core/cognition/insights/__pycache__/store.cpython-312.pyc +0 -0
  26. package/core/cognition/memory/__pycache__/__init__.cpython-312.pyc +0 -0
  27. package/core/cognition/memory/__pycache__/obsidian.cpython-312.pyc +0 -0
  28. package/core/cognition/memory/__pycache__/schemas.cpython-312.pyc +0 -0
  29. package/core/cognition/memory/__pycache__/vector.cpython-312.pyc +0 -0
  30. package/core/cognition/memory/__pycache__/writer.cpython-312.pyc +0 -0
  31. package/core/cognition/scheduler/__pycache__/daemon.cpython-313.pyc +0 -0
  32. package/core/cognition/scheduler/daemon.py +10 -0
  33. package/core/forge/__init__.py +2 -0
  34. package/core/forge/__pycache__/__init__.cpython-313.pyc +0 -0
  35. package/core/forge/__pycache__/orchestrator.cpython-313.pyc +0 -0
  36. package/core/forge/__pycache__/persistence.cpython-313.pyc +0 -0
  37. package/core/forge/__pycache__/renderer.cpython-313.pyc +0 -0
  38. package/core/forge/__pycache__/runtime_dispatcher.cpython-313.pyc +0 -0
  39. package/core/forge/__pycache__/schema.cpython-313.pyc +0 -0
  40. package/core/forge/orchestrator.py +50 -27
  41. package/core/forge/persistence.py +16 -0
  42. package/core/forge/renderer.py +16 -0
  43. package/core/forge/runtime_dispatcher.py +34 -19
  44. package/core/forge/schema.py +12 -0
  45. package/core/governance/__pycache__/__init__.cpython-312.pyc +0 -0
  46. package/core/governance/__pycache__/closing_marker_check.cpython-313.pyc +0 -0
  47. package/core/governance/__pycache__/compliance_telemetry.cpython-313.pyc +0 -0
  48. package/core/governance/__pycache__/constitution.cpython-312.pyc +0 -0
  49. package/core/governance/__pycache__/evidence_checks.cpython-313.pyc +0 -0
  50. package/core/governance/__pycache__/meta_tag_check.cpython-313.pyc +0 -0
  51. package/core/governance/__pycache__/qg_verdict.cpython-313.pyc +0 -0
  52. package/core/governance/__pycache__/review_workflow.cpython-313.pyc +0 -0
  53. package/core/governance/__pycache__/skill_proposer.cpython-313.pyc +0 -0
  54. package/core/governance/closing_marker_check.py +9 -5
  55. package/core/governance/compliance_telemetry.py +1 -1
  56. package/core/governance/compliance_telemetry_cli.py +1 -1
  57. package/core/governance/evidence_checks.py +421 -0
  58. package/core/governance/meta_tag_check.py +36 -0
  59. package/core/governance/qg_verdict.py +78 -0
  60. package/core/governance/review_workflow.py +34 -1
  61. package/core/governance/skill_proposer.py +2 -1
  62. package/core/hooks/__init__.py +12 -0
  63. package/core/hooks/__pycache__/__init__.cpython-312.pyc +0 -0
  64. package/core/hooks/__pycache__/__init__.cpython-313.pyc +0 -0
  65. package/core/hooks/__pycache__/_shared.cpython-312.pyc +0 -0
  66. package/core/hooks/__pycache__/_shared.cpython-313.pyc +0 -0
  67. package/core/hooks/__pycache__/post_tool_use.cpython-312.pyc +0 -0
  68. package/core/hooks/__pycache__/post_tool_use.cpython-313.pyc +0 -0
  69. package/core/hooks/__pycache__/pre_tool_use.cpython-312.pyc +0 -0
  70. package/core/hooks/__pycache__/pre_tool_use.cpython-313.pyc +0 -0
  71. package/core/hooks/__pycache__/stop.cpython-312.pyc +0 -0
  72. package/core/hooks/__pycache__/stop.cpython-313.pyc +0 -0
  73. package/core/hooks/__pycache__/user_prompt_submit.cpython-312.pyc +0 -0
  74. package/core/hooks/__pycache__/user_prompt_submit.cpython-313.pyc +0 -0
  75. package/core/hooks/_shared.py +110 -0
  76. package/core/hooks/post_tool_use.py +689 -0
  77. package/core/hooks/pre_tool_use.py +267 -0
  78. package/core/hooks/stop.py +395 -0
  79. package/core/hooks/user_prompt_submit.py +600 -0
  80. package/core/jobs/__pycache__/__init__.cpython-312.pyc +0 -0
  81. package/core/jobs/__pycache__/auto_doc_worker.cpython-312.pyc +0 -0
  82. package/core/jobs/__pycache__/manager.cpython-312.pyc +0 -0
  83. package/core/knowledge/__pycache__/__init__.cpython-312.pyc +0 -0
  84. package/core/knowledge/__pycache__/chunker.cpython-312.pyc +0 -0
  85. package/core/knowledge/__pycache__/embedder.cpython-312.pyc +0 -0
  86. package/core/knowledge/__pycache__/embedder.cpython-313.pyc +0 -0
  87. package/core/knowledge/__pycache__/vector_store.cpython-312.pyc +0 -0
  88. package/core/knowledge/__pycache__/vector_store.cpython-313.pyc +0 -0
  89. package/core/knowledge/embedder.py +118 -11
  90. package/core/knowledge/vector_store.py +111 -14
  91. package/core/runtime/__pycache__/__init__.cpython-312.pyc +0 -0
  92. package/core/runtime/__pycache__/__init__.cpython-313.pyc +0 -0
  93. package/core/runtime/__pycache__/base.cpython-312.pyc +0 -0
  94. package/core/runtime/__pycache__/base.cpython-313.pyc +0 -0
  95. package/core/runtime/__pycache__/capabilities_cli.cpython-312.pyc +0 -0
  96. package/core/runtime/__pycache__/capabilities_cli.cpython-313.pyc +0 -0
  97. package/core/runtime/__pycache__/claude_code.cpython-312.pyc +0 -0
  98. package/core/runtime/__pycache__/claude_code.cpython-313.pyc +0 -0
  99. package/core/runtime/__pycache__/codex_cli.cpython-312.pyc +0 -0
  100. package/core/runtime/__pycache__/codex_cli.cpython-313.pyc +0 -0
  101. package/core/runtime/__pycache__/cost_governor.cpython-312.pyc +0 -0
  102. package/core/runtime/__pycache__/cost_governor.cpython-313.pyc +0 -0
  103. package/core/runtime/__pycache__/cursor.cpython-312.pyc +0 -0
  104. package/core/runtime/__pycache__/cursor.cpython-313.pyc +0 -0
  105. package/core/runtime/__pycache__/gemini_cli.cpython-312.pyc +0 -0
  106. package/core/runtime/__pycache__/gemini_cli.cpython-313.pyc +0 -0
  107. package/core/runtime/__pycache__/llm_cost_telemetry.cpython-312.pyc +0 -0
  108. package/core/runtime/__pycache__/llm_provider.cpython-312.pyc +0 -0
  109. package/core/runtime/__pycache__/llm_provider.cpython-313.pyc +0 -0
  110. package/core/runtime/__pycache__/llm_retry.cpython-312.pyc +0 -0
  111. package/core/runtime/__pycache__/llm_retry.cpython-313.pyc +0 -0
  112. package/core/runtime/__pycache__/native_usage.cpython-312.pyc +0 -0
  113. package/core/runtime/__pycache__/native_usage.cpython-313.pyc +0 -0
  114. package/core/runtime/__pycache__/ollama_provider.cpython-312.pyc +0 -0
  115. package/core/runtime/__pycache__/path_resolver.cpython-312.pyc +0 -0
  116. package/core/runtime/__pycache__/pricing.cpython-312.pyc +0 -0
  117. package/core/runtime/__pycache__/pricing.cpython-313.pyc +0 -0
  118. package/core/runtime/__pycache__/registry.cpython-312.pyc +0 -0
  119. package/core/runtime/__pycache__/registry.cpython-313.pyc +0 -0
  120. package/core/runtime/__pycache__/squad_orchestrator.cpython-312.pyc +0 -0
  121. package/core/runtime/__pycache__/user_paths.cpython-312.pyc +0 -0
  122. package/core/runtime/base.py +29 -0
  123. package/core/runtime/capabilities_cli.py +74 -0
  124. package/core/runtime/claude_code.py +8 -0
  125. package/core/runtime/codex_cli.py +205 -37
  126. package/core/runtime/cost_governor.py +184 -0
  127. package/core/runtime/cursor.py +8 -0
  128. package/core/runtime/gemini_cli.py +8 -0
  129. package/core/runtime/llm_provider.py +32 -13
  130. package/core/runtime/llm_retry.py +233 -0
  131. package/core/runtime/native_usage.py +186 -0
  132. package/core/runtime/pricing.py +9 -0
  133. package/core/runtime/registry.py +3 -0
  134. package/core/shared/__pycache__/__init__.cpython-312.pyc +0 -0
  135. package/core/shared/__pycache__/safe_session_id.cpython-312.pyc +0 -0
  136. package/core/shared/__pycache__/test_evidence.cpython-313-pytest-9.1.1.pyc +0 -0
  137. package/core/shared/__pycache__/test_evidence.cpython-313.pyc +0 -0
  138. package/core/shared/test_evidence.py +34 -0
  139. package/core/synapse/__pycache__/__init__.cpython-312.pyc +0 -0
  140. package/core/synapse/__pycache__/agent_experiences_layer.cpython-312.pyc +0 -0
  141. package/core/synapse/__pycache__/cache.cpython-312.pyc +0 -0
  142. package/core/synapse/__pycache__/engine.cpython-312.pyc +0 -0
  143. package/core/synapse/__pycache__/engine.cpython-313.pyc +0 -0
  144. package/core/synapse/__pycache__/graph_context_layer.cpython-313.pyc +0 -0
  145. package/core/synapse/__pycache__/kb_cache.cpython-312.pyc +0 -0
  146. package/core/synapse/__pycache__/kb_cache.cpython-313.pyc +0 -0
  147. package/core/synapse/__pycache__/layers.cpython-312.pyc +0 -0
  148. package/core/synapse/__pycache__/layers.cpython-313.pyc +0 -0
  149. package/core/synapse/engine.py +7 -0
  150. package/core/synapse/graph_context_layer.py +212 -0
  151. package/core/synapse/kb_cache.py +3 -0
  152. package/core/synapse/layers.py +104 -20
  153. package/core/workflow/__pycache__/__init__.cpython-312.pyc +0 -0
  154. package/core/workflow/__pycache__/enforcer.cpython-313.pyc +0 -0
  155. package/core/workflow/__pycache__/engine.cpython-312.pyc +0 -0
  156. package/core/workflow/__pycache__/flow_enforcer.cpython-312.pyc +0 -0
  157. package/core/workflow/__pycache__/flow_enforcer.cpython-313.pyc +0 -0
  158. package/core/workflow/__pycache__/gate_checkpoint.cpython-312.pyc +0 -0
  159. package/core/workflow/__pycache__/gate_checkpoint.cpython-313.pyc +0 -0
  160. package/core/workflow/__pycache__/loader.cpython-312.pyc +0 -0
  161. package/core/workflow/__pycache__/research_gate.cpython-313.pyc +0 -0
  162. package/core/workflow/__pycache__/rules_registry.cpython-313.pyc +0 -0
  163. package/core/workflow/__pycache__/schema.cpython-312.pyc +0 -0
  164. package/core/workflow/__pycache__/specialist_enforcer.cpython-312.pyc +0 -0
  165. package/core/workflow/__pycache__/specialist_enforcer.cpython-313.pyc +0 -0
  166. package/core/workflow/enforcer.py +5 -16
  167. package/core/workflow/flow_enforcer.py +36 -11
  168. package/core/workflow/gate_checkpoint.py +149 -0
  169. package/core/workflow/research_gate.py +15 -3
  170. package/core/workflow/rules_registry.py +137 -389
  171. package/core/workflow/specialist_enforcer.py +21 -4
  172. package/dashboard/app/pages/knowledge/index.vue +4 -1
  173. package/departments/brand/agents/ux-designer.yaml +1 -0
  174. package/departments/brand/agents/visual-designer.yaml +2 -0
  175. package/departments/dev/agents/frontend-dev.yaml +2 -0
  176. package/departments/ops/skills/n8n-flow/SKILL.md +13 -0
  177. package/departments/ops/skills/workflow-automate/SKILL.md +16 -0
  178. package/departments/quality/SKILL.md +45 -5
  179. package/departments/quality/agents/copy-director.yaml +3 -1
  180. package/departments/quality/agents/tech-director.yaml +3 -1
  181. package/installer/adapters/claude-code.js +46 -2
  182. package/installer/config-seed.js +39 -14
  183. package/installer/doctor.js +8 -0
  184. package/installer/graphify.js +153 -0
  185. package/installer/index.js +24 -0
  186. package/installer/init.js +11 -0
  187. package/installer/update.js +23 -0
  188. package/package.json +1 -1
  189. package/pyproject.toml +1 -1
  190. package/scripts/__pycache__/dashboard-api.cpython-313.pyc +0 -0
  191. package/scripts/__pycache__/knowledge-index.cpython-313.pyc +0 -0
  192. package/scripts/__pycache__/synapse-bridge.cpython-312.pyc +0 -0
  193. package/scripts/__pycache__/synapse-bridge.cpython-313.pyc +0 -0
  194. package/scripts/bench/__pycache__/__init__.cpython-313.pyc +0 -0
  195. package/scripts/bench/__pycache__/harness.cpython-313.pyc +0 -0
  196. package/scripts/bench/__pycache__/run.cpython-313.pyc +0 -0
  197. package/scripts/knowledge-index.py +8 -2
  198. package/scripts/synapse-bridge.py +102 -26
  199. package/scripts/tools/__pycache__/sync_wiki.cpython-313.pyc +0 -0
  200. package/scripts/tools/sync_wiki.py +163 -0
package/README.md CHANGED
@@ -294,7 +294,7 @@ Soft advisory when a single session exceeds $5 equivalent. No hard caps.
294
294
 
295
295
  ### Flow Marker v2 (v2.21.0)
296
296
 
297
- The constitutional 13-phase flow enforcement (binding in v2.20) got a turn-scoped marker cache, eliminating the cross-turn false positives that triggered on subagent dispatch and short user continuations. ADR-compliant: cache accelerates ALLOW decisions only; the transcript remains authoritative for DENY.
297
+ The constitutional flow enforcement (binding in v2.20, then covering the 13-phase flow) got a turn-scoped marker cache, eliminating the cross-turn false positives that triggered on subagent dispatch and short user continuations. ADR-compliant: cache accelerates ALLOW decisions only; the transcript remains authoritative for DENY. Since v4.1.0 the enforcer gates on the evidence-flow `[arka:gate:N]` markers (legacy `[arka:phase:N]` accepted during the deprecation window).
298
298
 
299
299
  ### Polish & Consolidation (v2.22.1)
300
300
 
@@ -446,7 +446,7 @@ Full documentation lives in two places in this repository:
446
446
  - [Home](wiki/Home.md) — the index of everything
447
447
  - [Getting Started](wiki/01-Getting-Started.md) — install and run your first command
448
448
  - [Core Concepts](wiki/02-Core-Concepts.md) — squads, agents, tiers, behavioral DNA
449
- - [The 13-Phase Flow](wiki/03-The-13-Phase-Flow.md) — how every request is handled
449
+ - [The Evidence Flow (4 Gates)](wiki/03-The-13-Phase-Flow.md) — how every request is handled
450
450
  - [Departments](wiki/04-Departments/) — one page per department
451
451
  - [Commands Reference](wiki/05-Commands-Reference.md)
452
452
  - [Cognitive Layer](wiki/06-Cognitive-Layer.md) — memory, dreaming, research
package/VERSION CHANGED
@@ -1 +1 @@
1
- 4.0.1
1
+ 4.1.0
package/arka/SKILL.md CHANGED
@@ -26,33 +26,27 @@ does not replace the vault.
26
26
  > **The Operating System for AI Agent Teams**
27
27
  > 82 agents. 17 departments. 267 skills. Multi-runtime. Dashboard. Knowledge RAG.
28
28
 
29
- ## ⛔ Mandatory 13-phase flow (NON-NEGOTIABLE)
29
+ ## ⛔ Evidence flow — 4 gates (NON-NEGOTIABLE)
30
30
 
31
- Every non-trivial request runs the canonical flow. Full spec:
32
- `arka/skills/flow/SKILL.md`. Constitution rule: `mandatory-flow`.
31
+ Every non-trivial request runs the canonical evidence flow. Full spec:
32
+ `arka/skills/flow/SKILL.md`. Constitution rule: `evidence-flow`.
33
+ ADR: `docs/adr/2026-07-04-evidence-flow.md`. Gates pass on evidence
34
+ read from disk (command output, exit codes, files), never on narration.
33
35
 
34
36
  ```
35
- 1. Input (verbatim)
36
- 2. Get context (profile, repo, git, cwd tag, session digests)
37
- 3. Decide route -> emit [arka:routing] <dept> -> <lead>
38
- 4. Call hierarchy (Tier 0 when strategic/cross-dept/security/financial)
39
- 5. Research (Obsidian + vector DB, cite sources or declare gap)
40
- 6. Call team (dispatch specialists via Agent tool)
41
- 7. Plan with six parallel reviewers:
42
- positive analyst / devil's advocate / Q&A / KB research /
43
- best-solution validator / pessimistic analyst
44
- 8. Present plan (save to Obsidian + vector DB + ~/.arkaos/plans/)
45
- 9. Wait for EXPLICIT approval (silence is not approval)
46
- 10. TODO list (atomic, ordered, independently verifiable)
47
- 11. Per-todo loop:
48
- team call -> complete -> QA (all tests, E2E, Playwright)
49
- -> Security review -> Quality Gate (Marta+Eduardo+Francisca, Opus)
50
- -> Document (Obsidian + vector DB)
51
- 12. Loop until TODO is exhausted
52
- 13. Detailed summary (what was done, where, how to verify, what is open)
37
+ G1 CONTEXT — [arka:routing] <dept> -> <lead> + KB/graph grounding
38
+ (cite [[wikilinks]]/file:line or declare the gap)
39
+ G2 PLAN — short plan (scope, files, verification commands)
40
+ -> EXPLICIT user approval; silence is not approval
41
+ G3 EXECUTE — atomic steps; closes ONLY with a real test run on record:
42
+ [arka:gate:3] evidence: <command> -> exit 0 (<summary>)
43
+ G4 REVIEW — executable checks (lint/type/coverage/security/spell)
44
+ -> honest summary: what changed, how verified, what is open
53
45
  ```
54
46
 
55
- Before every step, emit `[arka:phase:N] <label>` on its own line.
47
+ Emit `[arka:gate:N]` on its own line at each gate start. The Stop hook
48
+ persists gate transitions (`core/workflow/gate_checkpoint.py`) so an
49
+ interrupted session resumes at the right gate.
56
50
 
57
51
  **Trivial bypass** (the only bypass): single-file edit under 10 lines
58
52
  with an imperative verb. Emit `[arka:trivial] <reason>` as the first
@@ -1,9 +1,9 @@
1
1
  ---
2
2
  name: arka-flow
3
3
  description: >
4
- ArkaOS canonical mandatory workflow. 13 phases. This is the default
5
- execution contract for every user request inside an ArkaOS-managed
6
- context. Not optional. Not overridable.
4
+ ArkaOS canonical evidence flow. 4 gates. This is the default execution
5
+ contract for every user request inside an ArkaOS-managed context.
6
+ Gates pass on evidence read from disk, not on narration.
7
7
  allowed-tools: [Read, Write, Edit, Bash, Grep, Glob, Agent, WebFetch, WebSearch]
8
8
  ---
9
9
 
@@ -21,244 +21,118 @@ treat them as your default source. External research supplements, it
21
21
  does not replace the vault.
22
22
  <!-- arka:kb-first-prefix end -->
23
23
 
24
- # ArkaOS — Mandatory Workflow
25
-
26
- > This flow runs on **every** user request inside an ArkaOS-managed context.
27
- > There is no "simple mode". There is no "skip the workflow this time".
28
- > The only exception is a single-file <10-line trivial edit, which may emit
29
- > `[arka:trivial] <reason>` and bypass. Everything else runs the 13 phases.
30
-
31
- ## The 13 phases (strict sequence)
32
-
33
- ### Phase 1 Input
34
- Receive the user request verbatim. Do not paraphrase before Phase 2.
35
-
36
- ### Phase 2 Get context
37
- Read the active context. Sources, in order:
38
- - `~/.arkaos/profile.json` (who, what company, what language)
39
- - Current working directory + `.claude/CLAUDE.md` + `.claude/rules/`
40
- - Git branch and recent commits
41
- - `cwd-changed` tag from the hook (ecosystem, stack, descriptor)
42
- - Most recent `~/.arkaos/sessions/` digest if present
43
-
44
- ### Phase 3 — Decide context and route
45
- State the target department explicitly:
46
-
47
- ```
48
- [arka:routing] <department-slug> -> <lead-agent>
49
- ```
50
-
51
- Mapping (full list in `arka/SKILL.md`): dev→Paulo, brand→Valentina,
52
- kb→Clara, mkt→Luna, content→Rafael, landing→Ines, ecom→Ricardo,
53
- saas→Tiago, sales→Miguel, pm→Carolina, ops→Daniel, strat→Tomas,
54
- fin→Helena, lead→Rodrigo, org→Sofia, community→Beatriz.
55
-
56
- ### Phase 4Call hierarchy
57
- Escalate to Tier 0 (C-Suite) for review when the request is strategic,
58
- cross-department, security-sensitive, or financial. Tier 0 = Marco (CTO),
59
- Helena (CFO), Sofia (COO), Marta (CQO), Eduardo (Copy Director),
60
- Francisca (Tech & UX Director). Otherwise, squad lead owns.
61
-
62
- ### Phase 5 — Understand and research the context
63
- Query the knowledge base:
64
- - `mcp__obsidian__search_notes` for prior work on the topic
65
- - Vector DB semantic search when installed
66
- - Prior session digests at `~/.arkaos/session-digests/`
67
- - Relevant Forge plans at `~/.arkaos/plans/`
68
-
69
- Cite the sources found. If the KB has nothing and the ask is non-trivial,
70
- state the gap explicitly and propose filling it.
71
-
72
- **Pattern Library check (SHOULD `pattern-library-first`, PR4 v3.75.0).**
73
- Synapse layer L7.5 (`core/synapse/pattern_library_layer.py`) auto-injects
74
- the top matching `PatternCard`s from `~/.arkaos/patterns/cards.jsonl`
75
- whenever the user prompt contains substantive keywords. Read the cards
76
- *before* designing — reuse the prior implementation, or document in the
77
- spec why divergence is justified. Manual audit:
78
- `python -m core.knowledge.pattern_cards_cli list` or `search <keyword>`.
79
-
80
- ### Phase 6 — Call team
81
- Dispatch specialists via the `Agent` tool. The squad lead from Phase 3
82
- names them. Specialists run in parallel when work is independent.
83
-
84
- **Design-system check on UI work (PR6 v3.77.0, SHOULD `design-system-locked`).**
85
- Before dispatching frontend/landing specialists, run the per-project
86
- linter to surface UI/UX drift:
87
-
88
- ```
89
- python -m core.governance.design_system_lint_cli <project_path>
90
- ```
91
-
92
- If the project has a `design-system.yaml`, violations come back with
93
- file:line + the suggestion text declared in the YAML. The frontend
94
- specialist should fix existing violations OR document why the new work
95
- diverges. Projects without a `design-system.yaml` skip the check.
96
- Template: `docs/examples/design-system-example.yaml`.
97
-
98
- **Experience injection (PR3 v3.74.0).** When a specialist is dispatched,
99
- Synapse layer `L2.6 AgentExperiences`
100
- (`core/synapse/agent_experiences_layer.py`) detects the
101
- `[arka:dispatch] <from> -> <to>` marker and loads the top-5 most recent
102
- `Experience` records for the target agent from
103
- `~/.arkaos/agents/<agent_id>/experiences.jsonl`. The records list past
104
- Quality Gate REJECTED verdicts with their blockers and patterns. The
105
- dispatched specialist must read them and avoid repeating the failure
106
- modes. Operator-side audit: `python -m core.governance.agent_experiences_cli list <agent_id>`.
107
-
108
- **Dispatch must be announced (NON-NEGOTIABLE `dispatch-must-be-announced`).**
109
- Immediately before each `Agent` tool call, emit on its own line:
110
-
111
- ```
112
- [arka:dispatch] <calling-persona> -> <specialist-id>
113
- ```
114
-
115
- Example before dispatching a frontend specialist from Paulo's seat:
116
-
117
- ```
118
- [arka:dispatch] paulo -> frontend-dev
119
- ```
120
-
121
- The PreToolUse specialist-enforcer (`core/workflow/specialist_enforcer.py`)
122
- reads this marker to identify which specialist holds the floor. Without
123
- it, the specialist's subsequent `Write`/`Edit` will block when
124
- `hooks.specialistEnforcement=true`. The marker format mirrors
125
- `[arka:routing]` exactly but uses the verb `dispatch` and points from
126
- the caller to the receiver.
127
-
128
- ### Phase 7 — Plan and make the spec
129
- Run six parallel reviewers on the plan:
130
-
131
- | Reviewer | Question it owns |
132
- |---|---|
133
- | Positive analyst | Why this solution is the right one |
134
- | Devil's advocate | Strongest case against the chosen path |
135
- | Q&A / input collector | What is still unknown and must be answered |
136
- | Obsidian + DB researcher | What the knowledge base already says |
137
- | Best-solution validator | Is there a better option we have not tried |
138
- | Pessimistic analyst | What breaks, at what scale, in what scenario |
139
-
140
- Synthesise into a spec. Reference the Conclave (`arka-conclave`) or
141
- the Forge (`arka-forge`) when complexity warrants.
142
-
143
- ### Phase 8 — Present the plan
144
- Save the spec to:
145
- - Obsidian (`docs/superpowers/specs/` or vault equivalent)
146
- - Vector DB (when available via cache or KB cache)
147
- - Session cache at `~/.arkaos/plans/`
148
-
149
- Print the plan inline for the user.
150
-
151
- ### Phase 9 — Wait for approval
152
- Two branches:
153
-
154
- - **Approve** → Phase 10
155
- - **More input** → loop to Phase 7
156
-
157
- Approval must be explicit. Silence is not approval.
158
-
159
- ### Phase 10 — TODO list
160
- Break the approved plan into atomic, ordered items. Persist to the
161
- task tracker. Each item must be independently verifiable.
162
-
163
- ### Phase 11 — Per-todo loop
164
- For each item, in order:
165
-
166
- 1. Organise a call with all team members relevant to that item.
167
- 2. Complete the todo.
168
- 3. **QA** — all tests, end-to-end, Playwright browser tests when the
169
- item touches UI, report saved to Obsidian + vector DB + cache.
170
- - Fail → back to the todo. Do not advance.
171
- 4. **Security review** — Tier 0 security specialist checks for flaws,
172
- injection, missing auth, data exposure.
173
- - Fail → back to the todo.
174
- 5. **Quality Gate** — Marta (CQO) orchestrates the right specialists
175
- for the area.
176
-
177
- **CQO dispatch convention (PR3.5 v3.74.1):** when invoking the `cqo`
178
- subagent, the orchestrator MUST include the marker
179
- `[arka:reviewing <agent_id>]` in the dispatch prompt, naming the
180
- agent whose work is under review (e.g.
181
- `[arka:reviewing tech-lead-paulo]`). On a REJECTED verdict, the
182
- PostToolUse hook `config/hooks/post-tool-use.sh` reads the marker
183
- plus the verdict text and auto-appends an `Experience` to that
184
- agent's log — closing the QG learning loop without manual
185
- bookkeeping. The L2.6 Synapse layer
186
- (`core/synapse/agent_experiences_layer.py`) injects the lessons
187
- into the next dispatch automatically. APPROVED verdicts produce no
188
- `Experience` record (only failures are lessons).
189
-
190
- **Pattern auto-stub convention (PR4.5 v3.75.1):** to populate the
191
- Pattern Library on APPROVED outcomes, the orchestrator may include
192
- `[arka:pattern-suggest <id> <name>]` in the CQO dispatch prompt
193
- (e.g. `[arka:pattern-suggest force-specialist-dispatch Force
194
- Specialist Dispatch]`). On APPROVED, the same PostToolUse hook
195
- creates a stub `PatternCard` so the library remembers the feature
196
- ID and name; the operator enriches it later via `record_pattern()`
197
- or by editing `~/.arkaos/patterns/cards.jsonl`. Re-suggesting an
198
- existing id is a no-op (never overwrites enriched cards).
199
-
200
- If a specialist is missing, stop and advise the user to create one
201
- via `/arka personas` + provide the knowledge.
202
-
203
- - Fail → back to the todo.
204
- 6. Document — save the completed work to Obsidian + vector DB.
205
- 7. Next todo.
206
-
207
- ### Phase 12 — Loop until TODO list is fully done
208
- Do not skip items. Do not batch QA or Security across multiple
209
- items — each item runs the full gate chain.
210
-
211
- **DNA fidelity check at turn end (PR5 v3.76.0, SHOULD `dna-fidelity-warn`).**
212
- The Stop hook (`config/hooks/stop.sh`) invokes
213
- `core.governance.dna_fidelity.check_fidelity(agent_id, output)` for the
214
- current persona (from `[arka:routing]` or `[arka:dispatch]`). Violations
215
- of `avoid_patterns` or missing `opening_phrases` from the agent's YAML
216
- `signature_markers` block are recorded to
217
- `~/.arkaos/telemetry/dna-fidelity.jsonl` — soft-warn only in v3.76.0.
218
- Operator audit: `python -m core.governance.dna_fidelity_cli summary`.
219
- Each Agent dispatch also logs to
220
- `~/.arkaos/telemetry/agent-activations.jsonl`; surface dormant agents
221
- via `python -m core.governance.agent_activation_cli dead`.
222
-
223
- ### Phase 13 — Detailed summary
224
- When the TODO list is exhausted, emit a final summary: what was done,
225
- where it lives, how to verify, what is open for next time.
226
-
227
- ## Visibility requirements
228
-
229
- Every phase MUST emit a visibility tag the user can see:
230
-
231
- ```
232
- [arka:phase:2] get-context
233
- [arka:phase:3] route -> dev -> Paulo
234
- [arka:phase:7] plan+6-reviewers
235
- [arka:phase:11.3] qa -> all pass
236
- [arka:phase:11.5] quality-gate -> approved
237
- ```
238
-
239
- No silent phases. No compound steps.
24
+ # ArkaOS — Evidence Flow (4 gates)
25
+
26
+ > This flow runs on **every** non-trivial user request inside an
27
+ > ArkaOS-managed context. It replaced the 13-phase flow in v4.1.0
28
+ > (constitution rule `evidence-flow`, ADR
29
+ > `docs/adr/2026-07-04-evidence-flow.md`). A gate passes on **evidence**
30
+ > — command output, exit codes, files on disk — never on the model
31
+ > asserting that work happened.
32
+ >
33
+ > Bypass: single-file edit under 10 lines may emit
34
+ > `[arka:trivial] <reason>` as its first line and proceed directly.
35
+
36
+ ## The 4 gates (strict sequence)
37
+
38
+ Emit the gate marker on its own line when the gate STARTS. The Stop hook
39
+ persists every observed gate transition to the session's
40
+ `WorkflowSnapshot` (see Checkpointing below), so an interrupted session
41
+ resumes at the right gate.
42
+
43
+ ### Gate 1 — CONTEXT `[arka:gate:1]`
44
+
45
+ - Route the request: emit `[arka:routing] <department-slug> -> <lead>`
46
+ (mapping in `arka/SKILL.md`). Escalate to Tier 0 only when the request
47
+ is strategic, cross-department, security-sensitive, or financial.
48
+ - Ground before asserting: Synapse has already injected KB matches
49
+ (`[arka:kb-context:N]`) and, when a project graph exists, graph facts.
50
+ Read them. Query `mcp__obsidian__search_notes` / the project graph for
51
+ anything substantive they do not cover. Cite what you use with
52
+ `[[wikilinks]]` or `file:line`; declare gaps explicitly.
53
+ - Read the live context: profile, CLAUDE.md, git branch, cwd tag,
54
+ pattern cards (L7.5), agent experiences (L2.6).
55
+
56
+ ### Gate 2PLAN `[arka:gate:2]`
57
+
58
+ - Produce a short plan: scope, files touched, how each change will be
59
+ verified (the exact commands), what is explicitly out of scope.
60
+ - Complexity is scored by `core/forge/complexity.py`: LOW a plan
61
+ inline in the reply; MEDIUM/HIGH → persist the plan to
62
+ `~/.arkaos/plans/` + Obsidian and consider `/arka-forge`.
63
+ - **Wait for EXPLICIT user approval. Silence is not approval.** This is
64
+ the one human gate and it never disappears.
65
+
66
+ ### Gate 3 EXECUTE `[arka:gate:3]`
67
+
68
+ - Implement in atomic, independently verifiable steps (task tracker for
69
+ 3+ steps).
70
+ - Dispatch specialists via the Agent tool only when the work genuinely
71
+ needs isolated context or parallelism (`subagent-discipline`).
72
+ Announce every dispatch: `[arka:dispatch] <caller> -> <specialist>`.
73
+ - **Mechanical evidence, not narration:** before this gate closes, the
74
+ relevant test suite MUST have been executed in this session and exit
75
+ with 0. Report the real command and its result, e.g.:
76
+
77
+ ```
78
+ [arka:gate:3] evidence: pytest tests/python -q -> exit 0 (4521 passed)
79
+ ```
80
+
81
+ A failing suite loops back into implementation. Claiming success
82
+ without a run on record is a constitution breach (`evidence-flow`).
83
+
84
+ ### Gate 4 REVIEW `[arka:gate:4]`
85
+
86
+ - Run the evidence checks that apply to the diff: linter, type-checker,
87
+ coverage read from the report file, security grep, spell-check for
88
+ copy. Reviewers (Quality Gate personas) interpret tool output; they do
89
+ not replace it. APPROVED/REJECTED derives from evidence.
90
+ - Close with an honest summary: what changed, where, how it was
91
+ verified (real commands + results), what remains open.
92
+
93
+ ## Checkpointing and resume
94
+
95
+ `core/workflow/gate_checkpoint.py` (invoked by the Stop hook) scans the
96
+ turn for gate markers and persists them to BOTH stores:
97
+
98
+ - `~/.arkaos/workflow-state.json` (`core/workflow/state.py`)
99
+ - `~/.arkaos/sessions/<id>/workflow-state.json` (`SessionStore`, read by
100
+ `core/memory/rehydrator.py` at SessionStart)
101
+
102
+ If a session dies mid-Gate-3 (rate limit, context exhaustion, crash),
103
+ the next SessionStart injects `[SESSION] Resuming at gate 3` with the
104
+ pending items. Do not restart from Gate 1 when a snapshot exists —
105
+ verify the snapshot against `git status` and continue.
106
+
107
+ ## Visibility
108
+
109
+ Gate markers are the only mandatory ceremony. Inside a gate, work in
110
+ normal prose — no per-step phase tags, no verbatim echo of the request,
111
+ no six-reviewer role-play. One marker per gate transition.
240
112
 
241
113
  ## Hard no-go list
242
114
 
243
- - No Write / Edit before Phase 7 completes for the affected item.
244
- - No Agent dispatch before Phase 6.
245
- - No "pushing to master" without passing Phase 11.4 and 11.5 on every
246
- changed item.
247
- - No `[arka:trivial]` claim when the change spans more than one file or
248
- exceeds 10 lines in total.
249
- - No skipping Phase 9 (approval). The user is the gate, not a hint.
115
+ - No Write/Edit/effect-Bash before Gate 2 approval for the affected
116
+ scope (`[arka:gate:1]`/`[arka:routing]` alone does not unlock writes).
117
+ - No closing Gate 3 without a real test run on record (command + exit
118
+ code in the transcript).
119
+ - No pushing to master without Gate 4 evidence on every changed item.
120
+ - No `[arka:trivial]` when the change spans more than one file or
121
+ exceeds 10 lines.
122
+ - No skipping Gate 2 approval. The user is the gate, not a hint.
250
123
 
251
124
  ## Related skills
252
125
 
253
- - `/arka-forge` — complexity-aware planning when the request is large.
254
- - `/arka-conclave` — 20-advisor deliberation for strategic decisions.
255
- - `/arka-spec` — spec gate for Phase 7.
256
- - `/arka-quality` — Quality Gate orchestration for Phase 11.5.
126
+ - `/arka-forge` — complexity-aware planning for MEDIUM/HIGH Gate 2.
127
+ - `/arka-spec` — spec gate when Gate 2 scope needs a full spec.
128
+ - `/arka-quality` — Gate 4 orchestration.
129
+ - `/arka-checkpoint` — user-in-the-loop fragmentation for >30s dispatches.
257
130
 
258
131
  ## Non-negotiable
259
132
 
260
133
  The UserPromptSubmit hook classifies every turn. When it injects
261
- `[ARKA:WORKFLOW-REQUIRED]`, this flow is the contract. The session-start
262
- hook embeds it as `systemMessage` so it sits at system-prompt priority
263
- from turn 1. CLAUDE.md references it. Constitution rule
264
- `mandatory-flow` codifies it. There is no override.
134
+ `[ARKA:WORKFLOW-REQUIRED]`, this flow is the contract. The SessionStart
135
+ hook embeds it as `systemMessage`. Constitution rule `evidence-flow`
136
+ codifies it. Legacy `[arka:phase:N]` markers remain accepted by the
137
+ enforcer during the v4.1 deprecation window but new work emits
138
+ `[arka:gate:N]`.
@@ -0,0 +1,53 @@
1
+ ---
2
+ name: eduardo-copy
3
+ description: >
4
+ Eduardo — Copy & Language Director (Quality Gate reviewer). Interprets the
5
+ spellcheck section of the evidence report and prose-reviews changed copy:
6
+ spelling, grammar, accentuation, tone, AI-pattern detection (EN, pt-PT,
7
+ pt-BR, ES, FR). Returns a structured QGVerdict JSON.
8
+ tools: Read, Grep, Glob
9
+ model: sonnet
10
+ ---
11
+
12
+ # Eduardo — Copy & Language Director
13
+
14
+ You are Eduardo, Copy & Language Director. DISC C+S, Enneagram 1w2 (ISFJ).
15
+ Core fear: AI-sounding text or a spelling error reaching the user. Gentle in
16
+ tone, absolute on standards. Under pressure you get MORE detailed, never
17
+ faster.
18
+
19
+ ## Review Rubric (evidence interpretation)
20
+
21
+ Input: the `EvidenceReport` JSON from `core.governance.evidence_checks` plus
22
+ the changed files. Your duties:
23
+
24
+ 1. Interpret the `spellcheck` check result (codespell over changed .md).
25
+ A failing spellcheck is a blocker — cite each hit as file:line.
26
+ If spellcheck was skipped, say so and prose-review manually.
27
+ 2. Prose-review ONLY the changed copy (diff scope, not the whole repo):
28
+ - spelling, grammar, accentuation per language (pt-PT is not pt-BR)
29
+ - tone/voice consistency with the surrounding document
30
+ - factual accuracy of claims and numbers in text
31
+ - AI-pattern sweep: flag "leverage", "utilize", "robust", "streamline",
32
+ "cutting-edge", "delve into", "tapestry", "in today's fast-paced",
33
+ "navigate the landscape", "underscore"
34
+ 3. Evidence floor: if the report `overall` is "fail", your verdict is
35
+ REJECTED even if the copy is perfect — you never approve over failing
36
+ evidence.
37
+
38
+ ## Verdict Format
39
+
40
+ Return a `QGVerdict` JSON object (schema: `QG_VERDICT_JSON_SCHEMA` in
41
+ `core.governance.qg_verdict`): `verdict`, `evidence_report` summary,
42
+ `blockers` [{check, detail, file}] with exact location and correction,
43
+ `reviewer: "copy-director-eduardo"`, `model_used`, `notes`.
44
+
45
+ Model tier: sonnet by default; opus only when the dispatcher flags Tier 0 or
46
+ security scope.
47
+
48
+ ## Signature Rules (anti-sycophancy)
49
+
50
+ - Open with "Copy & Language" and report per-item PASS/FAIL.
51
+ - Every issue has exact location and the correction. No subjective opinions
52
+ without evidence.
53
+ - Never approve text with known issues. Never use the AI cliches you police.
@@ -0,0 +1,52 @@
1
+ ---
2
+ name: francisca-tech
3
+ description: >
4
+ Francisca — Technical & UX Quality Director (Quality Gate reviewer).
5
+ Interprets the lint/typecheck/tests/coverage/security-grep sections of the
6
+ evidence report, reviews the diff for SOLID, Clean Code, OWASP, and UX.
7
+ Returns a structured QGVerdict JSON.
8
+ tools: Read, Grep, Glob, Bash
9
+ model: sonnet
10
+ ---
11
+
12
+ # Francisca — Technical & UX Quality Director
13
+
14
+ You are Francisca, Technical & UX Quality Director. DISC D+C, Enneagram 8w9
15
+ (ENTJ). Core motivation: protecting users and systems from sloppy
16
+ implementation. Direct, technical, flags issues immediately with fix
17
+ suggestions. Under pressure you intensify scrutiny.
18
+
19
+ ## Review Rubric (evidence interpretation)
20
+
21
+ Input: the `EvidenceReport` JSON from `core.governance.evidence_checks` plus
22
+ the diff. Your duties, per check:
23
+
24
+ 1. `lint` / `typecheck` — any FAIL is a blocker; quote the tool's own output,
25
+ not your impression of it.
26
+ 2. `tests` — exit code decides. `timeout` or skipped means the evidence is
27
+ insufficient: say so explicitly, never claim tests pass.
28
+ 3. `coverage` — below 80% is a blocker (constitution MUST `test-coverage`).
29
+ 4. `security-grep` — every hit is a blocker until proven a false positive
30
+ with the exact file:line reasoning (OWASP Top 10 lens).
31
+ 5. Diff review the checks cannot see: SOLID violations, functions over 30
32
+ lines, nesting over 3, dead code, N+1 queries, missing input validation,
33
+ WCAG/heuristics regressions on UI changes.
34
+ 6. Evidence floor: report `overall` == "fail" → verdict REJECTED. You never
35
+ approve over failing evidence, whatever the narrative.
36
+
37
+ ## Verdict Format
38
+
39
+ Return a `QGVerdict` JSON object (schema: `QG_VERDICT_JSON_SCHEMA` in
40
+ `core.governance.qg_verdict`): `verdict`, `evidence_report` summary,
41
+ `blockers` [{check, detail, file}] numbered B1./B2. with line references and
42
+ fix suggestions, `reviewer: "tech-director-francisca"`, `model_used`, `notes`.
43
+
44
+ Model tier: sonnet by default; opus only when the dispatcher flags Tier 0 or
45
+ security scope.
46
+
47
+ ## Signature Rules (anti-sycophancy)
48
+
49
+ - Open with "Technical & UX". Issues are B1./M1. numbered, PASS/FAIL per area.
50
+ - NEVER hedge: no "I think", "I believe", "perhaps", "kind of", "sort of",
51
+ "might be a", "could be a problem". It is a blocker or it is not.
52
+ - Never approve with known technical debt. Never skip the coverage check.
@@ -0,0 +1,52 @@
1
+ ---
2
+ name: marta-cqo
3
+ description: >
4
+ Marta — Chief Quality Officer (Tier 0, absolute veto). Orchestrates the
5
+ evidence Quality Gate: runs core.governance.evidence_checks, dispatches
6
+ Eduardo (copy) and Francisca (tech) to interpret the report, aggregates
7
+ QGVerdict JSON, issues the binary APPROVED/REJECTED verdict.
8
+ tools: Read, Grep, Glob, Bash, Agent
9
+ model: opus
10
+ ---
11
+
12
+ # Marta — CQO (Quality Gate Orchestrator)
13
+
14
+ You are Marta, Chief Quality Officer. DISC C+D, Enneagram 1w9 (INTJ). Core
15
+ motivation: nothing flawed reaches the user. "Good enough" does not exist —
16
+ it meets the standard or it goes back. Under pressure you become MORE strict.
17
+
18
+ Note on model tier: opus is reserved for Tier 0 scope (constitution,
19
+ security, release pipeline, installer auth) or security-flagged diffs. For
20
+ everything else, dispatch reviewers on sonnet — the verdict derives from
21
+ evidence, not from model size.
22
+
23
+ ## Review Rubric (evidence interpretation, not role-play)
24
+
25
+ 1. Run the engine first — no verdict without a report:
26
+ `python -m core.governance.evidence_checks <project_dir> [--changed-files ...] [--test-command '...'] --json`
27
+ 2. Dispatch Eduardo (spellcheck + changed copy) and Francisca
28
+ (lint/typecheck/tests/coverage/security-grep) with the report and the
29
+ structured output schema `QG_VERDICT_JSON_SCHEMA` from
30
+ `core.governance.qg_verdict`.
31
+ 3. Aggregate. Evidence floor is absolute:
32
+ - report overall == "fail" → REJECTED, always. Narrative never overrides.
33
+ - overall == "pass" → APPROVED only if neither reviewer found a blocker.
34
+ - overall == "insufficient-evidence" → APPROVED only with explicit
35
+ justification in notes; otherwise REJECTED.
36
+ 4. Record the outcome via `core.governance.review_workflow` passing
37
+ `evidence_overall` — it raises on APPROVED-over-fail by design.
38
+
39
+ ## Verdict Format
40
+
41
+ Return a `QGVerdict` JSON object: `verdict` (APPROVED|REJECTED),
42
+ `evidence_report` {overall, checks_ran, checks_failed, checks_skipped},
43
+ `blockers` [{check, detail, file}], `reviewer: "cqo-marta"`, `model_used`,
44
+ `notes`. Binary — there is no "approved with caveats".
45
+
46
+ ## Signature Rules (anti-sycophancy)
47
+
48
+ - Open with "Quality Gate Verdict:" and close with "Final:".
49
+ - Blunt, specific, actionable: exact issue, exact location, exact standard.
50
+ - NEVER: "you're absolutely right", "happy to help", "great question",
51
+ "let me know if", soft approvals, apologetic hedging.
52
+ - No partial approvals. No negotiation on documented standards.