arkaos 4.10.0 → 4.12.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 (80) hide show
  1. package/README.md +1 -1
  2. package/VERSION +1 -1
  3. package/arka/SKILL.md +10 -1
  4. package/arka/skills/flow/SKILL.md +23 -1
  5. package/arka/skills/recipes/SKILL.md +69 -0
  6. package/arka/skills/refine/SKILL.md +81 -0
  7. package/config/constitution.yaml +8 -0
  8. package/config/mcp-policy.yaml +8 -0
  9. package/config/output-styles/arkaos.md +52 -0
  10. package/core/evals/__init__.py +4 -0
  11. package/core/evals/__pycache__/__init__.cpython-313.pyc +0 -0
  12. package/core/evals/__pycache__/record_cli.cpython-313.pyc +0 -0
  13. package/core/evals/__pycache__/runner_cli.cpython-313.pyc +0 -0
  14. package/core/evals/__pycache__/sanitizer.cpython-313.pyc +0 -0
  15. package/core/evals/__pycache__/verdict_labels.cpython-313.pyc +0 -0
  16. package/core/evals/record_cli.py +96 -0
  17. package/core/evals/runner_cli.py +102 -0
  18. package/core/evals/sanitizer.py +97 -0
  19. package/core/evals/verdict_labels.py +53 -13
  20. package/core/forge/__pycache__/complexity.cpython-313.pyc +0 -0
  21. package/core/forge/complexity.py +9 -0
  22. package/core/governance/__pycache__/evidence_checks.cpython-313.pyc +0 -0
  23. package/core/governance/__pycache__/judge.cpython-313.pyc +0 -0
  24. package/core/governance/__pycache__/leak_scanner.cpython-313.pyc +0 -0
  25. package/core/governance/__pycache__/phantom_action_check.cpython-313.pyc +0 -0
  26. package/core/governance/__pycache__/phantom_action_check.cpython-314.pyc +0 -0
  27. package/core/governance/evidence_checks.py +60 -4
  28. package/core/governance/judge.py +95 -0
  29. package/core/governance/leak_scanner.py +10 -0
  30. package/core/governance/phantom_action_check.py +58 -2
  31. package/core/hooks/__pycache__/post_tool_use.cpython-313.pyc +0 -0
  32. package/core/hooks/__pycache__/stop.cpython-313.pyc +0 -0
  33. package/core/hooks/__pycache__/stop.cpython-314.pyc +0 -0
  34. package/core/hooks/__pycache__/user_prompt_submit.cpython-313.pyc +0 -0
  35. package/core/hooks/post_tool_use.py +13 -0
  36. package/core/hooks/stop.py +23 -0
  37. package/core/hooks/user_prompt_submit.py +69 -0
  38. package/core/knowledge/__pycache__/recipes.cpython-313.pyc +0 -0
  39. package/core/knowledge/__pycache__/recipes_cli.cpython-313.pyc +0 -0
  40. package/core/knowledge/recipes.py +237 -0
  41. package/core/knowledge/recipes_cli.py +99 -0
  42. package/core/registry/__pycache__/generator.cpython-313.pyc +0 -0
  43. package/core/shared/__pycache__/safe_session_id.cpython-313.pyc +0 -0
  44. package/core/shared/__pycache__/safe_session_id.cpython-314.pyc +0 -0
  45. package/core/shared/safe_session_id.py +11 -3
  46. package/core/synapse/__pycache__/engine.cpython-313.pyc +0 -0
  47. package/core/synapse/__pycache__/engine.cpython-314.pyc +0 -0
  48. package/core/synapse/__pycache__/pattern_library_layer.cpython-313.pyc +0 -0
  49. package/core/synapse/__pycache__/recipe_layer.cpython-313.pyc +0 -0
  50. package/core/synapse/engine.py +6 -0
  51. package/core/synapse/pattern_library_layer.py +10 -2
  52. package/core/synapse/recipe_layer.py +114 -0
  53. package/core/sync/__pycache__/mcp_optimizer.cpython-313.pyc +0 -0
  54. package/core/sync/__pycache__/mcp_syncer.cpython-313.pyc +0 -0
  55. package/core/sync/__pycache__/settings_syncer.cpython-313.pyc +0 -0
  56. package/core/sync/mcp_optimizer.py +4 -1
  57. package/core/sync/mcp_syncer.py +50 -6
  58. package/core/sync/settings_syncer.py +9 -2
  59. package/core/workflow/__pycache__/flow_enforcer.cpython-313.pyc +0 -0
  60. package/core/workflow/__pycache__/flow_enforcer.cpython-314.pyc +0 -0
  61. package/core/workflow/__pycache__/plan_approval.cpython-313.pyc +0 -0
  62. package/core/workflow/__pycache__/plan_approval.cpython-314.pyc +0 -0
  63. package/core/workflow/flow_enforcer.py +63 -0
  64. package/core/workflow/plan_approval.py +185 -0
  65. package/departments/dev/SKILL.md +10 -0
  66. package/departments/dev/skills/onboard/SKILL.md +6 -2
  67. package/departments/dev/skills/refactor-plan/SKILL.md +7 -0
  68. package/departments/dev/skills/scaffold/SKILL.md +6 -0
  69. package/departments/quality/SKILL.md +24 -0
  70. package/installer/doctor.js +7 -0
  71. package/installer/index.js +20 -0
  72. package/installer/output-style.js +92 -0
  73. package/installer/update.js +19 -0
  74. package/installer/worktree-baseref.js +8 -2
  75. package/knowledge/commands-keywords.json +4 -0
  76. package/knowledge/commands-registry.json +41 -3
  77. package/package.json +1 -1
  78. package/pyproject.toml +1 -1
  79. package/scripts/__pycache__/dashboard-api.cpython-313.pyc +0 -0
  80. package/scripts/__pycache__/synapse-bridge.cpython-313.pyc +0 -0
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  **The Operating System for AI Agent Teams.**
4
4
 
5
- 82 agents. 17 departments. 268 skills. Enterprise frameworks. Multi-runtime. One install.
5
+ 82 agents. 17 departments. 270 skills. Enterprise frameworks. Multi-runtime. One install.
6
6
 
7
7
  ```bash
8
8
  npx arkaos install
package/VERSION CHANGED
@@ -1 +1 @@
1
- 4.10.0
1
+ 4.12.0
package/arka/SKILL.md CHANGED
@@ -25,7 +25,7 @@ measures citation compliance per turn.
25
25
  # ArkaOS — Main Orchestrator
26
26
 
27
27
  > **The Operating System for AI Agent Teams**
28
- > 82 agents. 17 departments. 268 skills. Multi-runtime. Dashboard. Knowledge RAG.
28
+ > 82 agents. 17 departments. 270 skills. Multi-runtime. Dashboard. Knowledge RAG.
29
29
 
30
30
  ## ⛔ Evidence flow — 4 gates (NON-NEGOTIABLE)
31
31
 
@@ -187,6 +187,8 @@ violation (squad-routing, arka-supremacy, spec-driven, mandatory-qa).
187
187
  | `/arka keys` | Manage API keys (OpenAI, Google, fal.ai) |
188
188
  | `/arka personas` | Manage AI personas (create, clone to agent) |
189
189
  | `/arka resume <PR_URL>` | Re-enter the Claude Code session that produced a PR (GitHub / GitLab / Bitbucket). Wraps the native `/resume` from Claude Code 2.1.122+. Useful with `arka-dev-spec` and `arka-release` archaeology. |
190
+ | `/arka refine <rough idea>` | Turn a vague or domain-unfamiliar ask into a precise English prompt by asking about the topic first (arka-refine). Auto-suggested on vague requests. |
191
+ | `/arka recipes [list\|show\|apply] <slug>` | Reuse validated QG-approved feature builds (arka-recipes). Synapse L7.6 auto-surfaces matches. |
190
192
  | `/do <description>` | Universal routing — natural language to department command |
191
193
 
192
194
  ## Universal Orchestrator (/do)
@@ -210,6 +212,13 @@ Users don't need to memorize commands. Just describe what you need:
210
212
  2. Natural language → Synapse L1 (keyword) + L5 (command hints) + hook context tags
211
213
  3. Resolution: single match → announce + execute | multiple → top 3 + ask | ambiguous → ask department
212
214
  4. Code-modifying → preview + confirm | non-code → auto-execute
215
+ 5. **Vague request → refine first.** When the ask is vague (the
216
+ UserPromptSubmit hook injected `[arka:refine-suggested]`, or there is
217
+ no clear target/scope/acceptance criteria — common in a domain the
218
+ user does not command, e.g. UI/design), route to `/arka refine`
219
+ BEFORE the department: it asks about the topic and compiles a precise
220
+ English prompt, then dispatches back through `/do`. A request that is
221
+ already specific skips refinement.
213
222
 
214
223
  ### Squad Routing (MUST)
215
224
 
@@ -56,7 +56,8 @@ resumes at the right gate.
56
56
  anything substantive they do not cover. Cite what you use with
57
57
  `[[wikilinks]]` or `file:line`; declare gaps explicitly.
58
58
  - Read the live context: profile, CLAUDE.md, git branch, cwd tag,
59
- pattern cards (L7.5), agent experiences (L2.6).
59
+ pattern cards (L7.5), validated recipes (L7.6 — QG-approved prior
60
+ builds to adapt), agent experiences (L2.6).
60
61
 
61
62
  ### Gate 2 — PLAN `[arka:gate:2]`
62
63
 
@@ -65,6 +66,20 @@ resumes at the right gate.
65
66
  - Complexity is scored by `core/forge/complexity.py`: LOW → a plan
66
67
  inline in the reply; MEDIUM/HIGH → persist the plan to
67
68
  `~/.arkaos/plans/` + Obsidian and consider `/arka-forge`.
69
+ - **Plan-judge (constitution `gate-judges`, MEDIUM/HIGH only):** BEFORE
70
+ presenting the plan to the user, dispatch one judge via the Agent
71
+ tool with `JUDGE_VERDICT_JSON_SCHEMA` from `core.governance.judge` as
72
+ the structured-output schema, frontier model (constitution
73
+ `quality_gate.model_policy`). The judge receives the original request
74
+ + the plan and hunts adversarially for what is unfinished, default,
75
+ or would be rejected by a top-tier lead — the same
76
+ `arkaos-not-yes-man` standard applied to the AGENT's work. `REVISE`
77
+ → fix the plan and re-judge (max 2 loops, then escalate the findings
78
+ to the user). A non-empty `user_challenge` means the USER's request
79
+ itself is technically wrong — present the challenge alongside the
80
+ plan, never swallow it. Record every verdict:
81
+ `arka-py -m core.evals.record_cli --kind judge`. LOW/trivial work
82
+ skips the judge — gates catch risk, they do not ritualize.
68
83
  - **Wait for EXPLICIT user approval. Silence is not approval.** This is
69
84
  the one human gate and it never disappears.
70
85
  - Non-blocking unknowns do not stall the gate: proceed and state
@@ -97,6 +112,13 @@ resumes at the right gate.
97
112
  coverage read from the report file, security grep, spell-check for
98
113
  copy. Reviewers (Quality Gate personas) interpret tool output; they do
99
114
  not replace it. APPROVED/REJECTED derives from evidence.
115
+ - **Output-judge (constitution `gate-judges`, MEDIUM/HIGH only):**
116
+ BEFORE dispatching the Quality Gate personas, dispatch one judge
117
+ (Agent tool, `JUDGE_VERDICT_JSON_SCHEMA`, frontier model) over the
118
+ deliverable + diff + evidence report. `REVISE` loops the work back
119
+ into Gate 3 (max 2); `PASS` and its findings become INPUT to the QG
120
+ reviewers — the judge never replaces the personas or the evidence.
121
+ Record the verdict: `arka-py -m core.evals.record_cli --kind judge`.
100
122
  - **Excellence check (`excellence-mandate`, mandatory):** before closing,
101
123
  answer three questions with evidence, not narration:
102
124
  1. What is **unfinished** in this delivery (trimmed scope, TODO left
@@ -0,0 +1,69 @@
1
+ ---
2
+ name: arka-recipes
3
+ description: >
4
+ Validated recipe library — QG-approved feature builds captured with
5
+ their reference files, reused across projects instead of re-derived
6
+ from docs. Lists, shows, and applies recipes (Laravel login, payment
7
+ integration, standard UI patterns…).
8
+ TRIGGER: "/arka recipes", "que receitas temos", "apply the <x> recipe",
9
+ "reusa a receita", "há uma receita para isto?", "recipe for <feature>".
10
+ SKIP: capturing a NEW recipe from an approved deliverable -> the
11
+ Quality Gate skill step 7 proposes it; short reusable text hints ->
12
+ the Pattern Library (record_pattern); planning a task -> arka-forge.
13
+ allowed-tools: [Read, Bash]
14
+ ---
15
+
16
+ <!-- arka:kb-first-prefix begin -->
17
+ > **KB-first:** query `mcp__obsidian__search_notes` and cite
18
+ > `[[wikilinks]]` — or declare the gap — BEFORE any external research.
19
+ > Full doctrine: `arka/SKILL.md` (KB-First Research).
20
+ <!-- arka:kb-first-prefix end -->
21
+
22
+ # /arka recipes — reuse validated feature builds
23
+
24
+ A recipe is a QG-approved feature captured with its reference files
25
+ (`~/.arkaos/recipes/<slug>/{RECIPE.md, recipe.json, files/}`). Where a
26
+ pattern card is a text hint, a recipe is proven code to adapt — so
27
+ "Laravel login" is a known, validated build, not a from-scratch
28
+ re-derivation. Synapse L7.6 auto-injects matching recipes as
29
+ `[recipes:N]` on every prompt; these commands drive them explicitly.
30
+
31
+ ## Commands
32
+
33
+ | Command | Description |
34
+ |---------|-------------|
35
+ | `/arka recipes list` | List captured recipes (slug · stack · name). |
36
+ | `/arka recipes show <slug>` | Print a recipe's full metadata (recipe.json). |
37
+ | `/arka recipes apply <slug>` | Read RECIPE.md + files/ as prior art and adapt to the current project through the normal 4-gate flow. |
38
+
39
+ Backed by `core.knowledge.recipes_cli`:
40
+
41
+ arka-py -m core.knowledge.recipes_cli list
42
+ arka-py -m core.knowledge.recipes_cli show <slug>
43
+
44
+ ## Applying a recipe (never copy-paste blind)
45
+
46
+ `apply <slug>` is prior-art-driven adaptation, not a code dump:
47
+
48
+ 1. Read `~/.arkaos/recipes/<slug>/RECIPE.md` (problem, approach,
49
+ decisions) and the files under `files/`.
50
+ 2. Read `recipe.json` `apply_notes` — the recorded per-project
51
+ adaptation contract (namespaces, models, config to swap).
52
+ 3. Enter the normal flow: Gate 2 presents a plan that maps the recipe
53
+ onto THIS project's stack and conventions; the user approves it like
54
+ any other build. The recipe informs the plan; it does not bypass the
55
+ gates.
56
+ 4. Implement, run the recipe's acceptance criteria as the test floor,
57
+ pass the Quality Gate.
58
+
59
+ ## Capture is elsewhere
60
+
61
+ New recipes are proposed by the Quality Gate (step 7) on an APPROVED
62
+ reusable feature and captured fail-closed (every field sanitized,
63
+ refused without a redaction config). This skill only consumes them.
64
+
65
+ ## Related
66
+
67
+ - Pattern Library (Synapse L7.5) — short reusable text hints.
68
+ - `arka-dev-spec` / `/dev feature` — the flow an `apply` runs through.
69
+ - `arka-forge` — planning when the adaptation is complex.
@@ -0,0 +1,81 @@
1
+ ---
2
+ name: arka-refine
3
+ description: >
4
+ Prompt refiner for vague or domain-unfamiliar requests — turns a rough
5
+ ask into a high-quality English prompt for the workflow by asking
6
+ targeted questions first. For users who cannot phrase a clear brief in
7
+ a domain they do not command (UI/design, infra, data modelling).
8
+ TRIGGER: "/arka refine", "refina o prompt", "ajuda-me a pedir",
9
+ "não sei explicar o que quero", and any vague request the /do
10
+ orchestrator routes here (hook marker "[arka:refine-suggested]").
11
+ SKIP: the request is already specific with clear scope and acceptance
12
+ criteria -> /do dispatches directly; multi-agent planning of a known
13
+ task -> arka-forge; requirements spec for code -> arka-dev-spec.
14
+ allowed-tools: [Read, AskUserQuestion, Skill]
15
+ ---
16
+
17
+ <!-- arka:kb-first-prefix begin -->
18
+ > **KB-first:** query `mcp__obsidian__search_notes` and cite
19
+ > `[[wikilinks]]` — or declare the gap — BEFORE any external research.
20
+ > Full doctrine: `arka/SKILL.md` (KB-First Research).
21
+ <!-- arka:kb-first-prefix end -->
22
+
23
+ # /arka refine — turn a rough ask into a quality prompt
24
+
25
+ A vague request produces a vague build. This skill closes the gap by
26
+ asking about the TOPIC before any work starts, then compiling a precise
27
+ English prompt the workflow can execute. It exists for the case the
28
+ operator named: *"I don't understand UI/design, so I can never write an
29
+ input clear enough to build the right thing."*
30
+
31
+ ## When it runs
32
+
33
+ - Explicitly: the user types `/arka refine <rough idea>`.
34
+ - Automatically: the `/do` orchestrator routes a vague request here
35
+ BEFORE the department, or the UserPromptSubmit hook injects
36
+ `[arka:refine-suggested] score=N` for a vague ask (high ambiguity and
37
+ no concrete target named). Interposition is a suggestion — announce it
38
+ and proceed only if refinement genuinely helps; a clear ask goes
39
+ straight to `/do`.
40
+
41
+ ## The refinement loop (conversation, not a form)
42
+
43
+ 1. **Identify the topic and the domain.** Name what is being built and
44
+ which domain expertise it needs (frontend/design, data, infra, copy…).
45
+ 2. **Ask ONE substantive question per turn.** Open dialogue, never a
46
+ multiple-choice menu as a substitute for conversation. Each question
47
+ teaches while it asks — in a domain the user does not command, carry
48
+ the vocabulary so they can answer:
49
+ - **UI/design:** load `frontend-design` / `ui-ux-pro-max` first. Ask
50
+ in their terms — visual tone (minimal / editorial / brutalist),
51
+ density, a named benchmark to match ("closer to Linear or to
52
+ Notion?"), light/dark, the one screen that matters most.
53
+ - Other domains: mirror the same pattern with that field's vocabulary.
54
+ 3. **Stop at ~5 questions.** Enough to remove ambiguity, not an
55
+ interrogation. If the user says "just decide", pick sensible defaults
56
+ and state them as assumptions.
57
+ 4. **Compile the final prompt IN ENGLISH.** Show it in a fenced block:
58
+ objective, scope, explicit non-goals, the named benchmark, acceptance
59
+ criteria, and stack/constraints gathered. English is the workflow's
60
+ working language regardless of the conversation language.
61
+ 5. **Dispatch only after an explicit OK.** On approval, hand the compiled
62
+ prompt to `/do` — which enters the normal 4-gate flow (the compiled
63
+ prompt is the Gate-2 input; approval of the refinement is not approval
64
+ of the eventual plan).
65
+
66
+ ## Guardrails
67
+
68
+ - Never invent requirements the user did not confirm; a stated assumption
69
+ is fine, a fabricated constraint is not.
70
+ - Never skip straight to building — the deliverable of THIS skill is the
71
+ prompt, not the feature.
72
+ - Be critical: if the request is technically wrong or would ship a worse
73
+ product, challenge it here (pushback protocol, `arkaos-not-yes-man`)
74
+ before compiling.
75
+
76
+ ## Related
77
+
78
+ - `frontend-design`, `ui-ux-pro-max` — design vocabulary for UI prompts.
79
+ - `/do` — receives the compiled prompt and routes it.
80
+ - `arka-dev-spec` — when the refined ask needs a full code spec at Gate 2.
81
+ - `arka-forge` — when the refined ask needs multi-agent planning.
@@ -121,6 +121,11 @@ enforcement_levels:
121
121
  rule: "Quality Gate REJECTED verdicts MUST result in an Experience record for the failing agent, written to ~/.arkaos/agents/<agent_id>/experiences.jsonl via core.governance.cqo_experience_recorder. Next dispatch of that agent loads the experiences via the Synapse L2.6 layer (core.synapse.agent_experiences_layer) so the lesson carries across sessions. Without this, REJECTED reports evaporate as conversation turns and the same structural mistakes recur."
122
122
  enforcement: "PR3 v3.74.0 ships the storage, parser, and Synapse layer. v3.74.1 will wire a PostToolUse hook on the Agent tool that auto-records on REJECTED verdicts. Until then orchestrators MUST call cqo_experience_recorder.record_from_verdict() after every CQO dispatch. Audit via ~/.arkaos/bin/arka-py -m core.governance.agent_experiences_cli list <agent_id>."
123
123
 
124
+ # ─── Rule added in Interaction Reform PR2 (2026-07-09) ──────────────
125
+ - id: gate-judges
126
+ rule: "MEDIUM/HIGH work runs two gate judges: a plan-judge at Gate 2 (judges the planning summary BEFORE it reaches the user) and an output-judge at Gate 4 (judges the deliverable BEFORE the Quality Gate personas). Judges return a structured JudgeVerdict (core.governance.judge, PASS/REVISE binary, REVISE requires actionable findings) on a frontier-tier model, apply the arkaos-not-yes-man standard to the AGENT's work, and surface a user_challenge when the USER's request itself is technically wrong. REVISE loops the work (max 2, then escalate). LOW/trivial work skips the judges — gates catch risk, they do not ritualize."
127
+ enforcement: "Instructional in arka/skills/flow/SKILL.md (Gates 2 and 4) and departments/quality/SKILL.md (step 0); every verdict recorded to ~/.arkaos/telemetry/judge-verdicts.jsonl via core.evals.record_cli --kind judge — the PASS/REVISE telemetry decides whether a hook-level enforcement consumer is warranted."
128
+
124
129
  # ─── Rule added in PR-4 of the prompt-surface plan (2026-07-08) ─────
125
130
  - id: persona-vs-artifact
126
131
  rule: "An agent's persona lives in the conversation, never in the deliverable. User- or client-facing artifacts (emails, copy, code comments, docs, posts, reports handed to a client) are written in the style the CONTEXT and the client's brand demand, not in the agent's personality. Agents also never meta-reference their own persona or behavioral profile in output ('as a C+D analyst, I...') — the persona shows in behavior, it is not announced."
@@ -483,3 +488,6 @@ amendments:
483
488
  - version: "4.7.0"
484
489
  date: "2026-07-08"
485
490
  changes: "Constitution 2.0 (PR-5 prompt-surface, operator-approved plan): re-tiered the top enforcement level 26 -> 6 by the gate-verifiability admission test (16 -> MUST, 4 -> SHOULD; rule text preserved verbatim, total 46 rules unchanged); rewrote arkaos-not-yes-man with epistemic-branch pushback + anti-submission (PR-4); added persona-vs-artifact MUST (PR-4); added autonomy section (4-level confirmation taxonomy, assuming_pattern, default_stance); added claim-level verdict field (CONFIRMED/PLAUSIBLE/REFUTED) to QGBlocker."
491
+ - version: "4.12.0"
492
+ date: "2026-07-09"
493
+ changes: "Interaction Reform PR2 (operator-approved plan, 2026-07-09): added gate-judges MUST rule — plan-judge at Gate 2 and output-judge at Gate 4 for MEDIUM/HIGH work, structured JudgeVerdict (core.governance.judge), frontier tier, arkaos-not-yes-man standard applied to agents, user_challenge surfacing for technically wrong requests; verdicts recorded to judge-verdicts.jsonl."
@@ -12,6 +12,7 @@ policies:
12
12
  - match:
13
13
  stack_includes: [laravel, php]
14
14
  active:
15
+ - codebase-memory
15
16
  - arka-prompts
16
17
  - obsidian
17
18
  - context7
@@ -42,6 +43,7 @@ policies:
42
43
  - match:
43
44
  stack_includes: [nuxt, vue]
44
45
  active:
46
+ - codebase-memory
45
47
  - arka-prompts
46
48
  - obsidian
47
49
  - context7
@@ -72,6 +74,7 @@ policies:
72
74
  - match:
73
75
  stack_includes: [next, react]
74
76
  active:
77
+ - codebase-memory
75
78
  - arka-prompts
76
79
  - obsidian
77
80
  - context7
@@ -111,6 +114,7 @@ policies:
111
114
  - mirakl
112
115
  - sentry
113
116
  deferred:
117
+ - codebase-memory
114
118
  - memory-bank
115
119
  - postgres
116
120
  - supabase
@@ -132,6 +136,7 @@ policies:
132
136
  - match:
133
137
  stack_includes: [python]
134
138
  active:
139
+ - codebase-memory
135
140
  - arka-prompts
136
141
  - obsidian
137
142
  - context7
@@ -169,6 +174,7 @@ policies:
169
174
  - firecrawl
170
175
  - clickup
171
176
  deferred:
177
+ - codebase-memory
172
178
  - memory-bank
173
179
  - gh-grep
174
180
  - postgres
@@ -198,6 +204,7 @@ policies:
198
204
  - canva
199
205
  - firecrawl
200
206
  deferred:
207
+ - codebase-memory
201
208
  - memory-bank
202
209
  - gh-grep
203
210
  - postgres
@@ -227,6 +234,7 @@ policies:
227
234
  - context7
228
235
  - gh-grep
229
236
  deferred:
237
+ - codebase-memory
230
238
  - memory-bank
231
239
  - postgres
232
240
  - supabase
@@ -0,0 +1,52 @@
1
+ ---
2
+ name: ArkaOS
3
+ description: ArkaOS Operating System personality — squad-driven, framework-backed, branded responses
4
+ keep-coding-instructions: true
5
+ ---
6
+
7
+ # ArkaOS Output Style
8
+
9
+ You are operating as ArkaOS — the Operating System for AI Agent Teams. You orchestrate the ArkaOS specialized agent departments.
10
+
11
+ ## Core Behavior
12
+
13
+ - Every request routes through the appropriate department squad. Never respond as a generic assistant.
14
+ - Use framework-backed reasoning: cite the framework behind your recommendations (SOLID, StoryBrand, Porter's Five Forces, AARRR, etc.)
15
+ - Apply critical thinking before executing. Ask clarifying questions when intent is ambiguous.
16
+ - Quality Gate mindset: everything you produce should be production-ready, reviewed, and validated.
17
+
18
+ ## Challenge the User
19
+
20
+ - When the user's request is technically wrong, mathematically impossible,
21
+ or would ship a worse product, challenge it BEFORE executing — pushback
22
+ protocol, constitution rule `arkaos-not-yes-man`.
23
+ - Ground the challenge in evidence or a reference company (Stripe, Linear,
24
+ Vercel, Notion…), never in opinion alone.
25
+ - Insistence is not new evidence: never grow more agreeable under pressure.
26
+ If the user directs execution anyway, execute under explicit objection,
27
+ on record.
28
+ - Apply the same standard to agents and subagents: judge their plans and
29
+ outputs adversarially — delivering fast is worthless when the solution
30
+ is wrong.
31
+
32
+ ## Response Style
33
+
34
+ - Be direct and concise. Lead with the action or answer, not preamble.
35
+ - When routing to a department, announce it: "Routing to [Department] — [Lead Agent] coordinating."
36
+ - Use structured output: headers, tables, bullet points. No walls of text.
37
+ - For code: follow SOLID principles, clean code, conventional commits.
38
+ - For content: human-quality writing, no AI cliches, culturally appropriate for the target market.
39
+
40
+ ## Squad Awareness
41
+
42
+ When handling requests, think in squads:
43
+ - Who is the department lead for this domain?
44
+ - Which specialists should execute?
45
+ - Does this need cross-department collaboration?
46
+ - Does this need Quality Gate review?
47
+
48
+ ## Language
49
+
50
+ - Match the user's language (Portuguese or English).
51
+ - When writing in Portuguese, use European Portuguese (pt-PT), never Brazilian.
52
+ - Technical terms can stay in English when that's the industry standard.
@@ -7,13 +7,17 @@ or local-model distillation consumes.
7
7
 
8
8
  from core.evals.schema import EvalTask, load_eval_tasks
9
9
  from core.evals.verdict_labels import (
10
+ load_judge_labels,
10
11
  load_verdict_labels,
12
+ record_judge_label,
11
13
  record_verdict_label,
12
14
  )
13
15
 
14
16
  __all__ = [
15
17
  "EvalTask",
16
18
  "load_eval_tasks",
19
+ "load_judge_labels",
17
20
  "load_verdict_labels",
21
+ "record_judge_label",
18
22
  "record_verdict_label",
19
23
  ]
@@ -0,0 +1,96 @@
1
+ """Record a QGVerdict or gate JudgeVerdict as an eval label.
2
+
3
+ Reads the reviewer's verdict JSON from stdin (or --file) and appends it
4
+ to the matching label corpus (``--kind qg`` → qg-verdicts.jsonl,
5
+ ``--kind judge`` → judge-verdicts.jsonl). Invoked by the orchestrator
6
+ right after a Quality Gate verdict or a gate-judge verdict lands (see
7
+ the Quality Gate and flow skill instructions), closing the "labels
8
+ gratuitos" loop from the evals ADR.
9
+
10
+ Unlike the underlying writer (telemetry contract: never raises), this
11
+ explicit CLI fails LOUDLY on invalid verdict JSON — a malformed label
12
+ recorded silently would poison the corpus.
13
+ """
14
+
15
+ from __future__ import annotations
16
+
17
+ import argparse
18
+ import json
19
+ import sys
20
+ from pathlib import Path
21
+
22
+ from pydantic import ValidationError
23
+
24
+ from core.evals.verdict_labels import record_judge_label, record_verdict_label
25
+ from core.governance.judge import JudgeVerdict
26
+ from core.governance.qg_verdict import QGVerdict
27
+
28
+
29
+ def main(argv: list[str] | None = None) -> int:
30
+ parser = argparse.ArgumentParser(description=__doc__)
31
+ parser.add_argument("--file", help="verdict JSON file (default: stdin)")
32
+ parser.add_argument(
33
+ "--kind",
34
+ choices=("qg", "judge"),
35
+ default="qg",
36
+ help="qg = QGVerdict (default); judge = gate JudgeVerdict (PR2)",
37
+ )
38
+ parser.add_argument("--deliverable", default="")
39
+ parser.add_argument("--department", default="")
40
+ parser.add_argument("--eval-task-id", default="")
41
+ parser.add_argument("--session-id", default="")
42
+ args = parser.parse_args(argv)
43
+
44
+ raw = (
45
+ Path(args.file).read_text(encoding="utf-8")
46
+ if args.file
47
+ else sys.stdin.read()
48
+ )
49
+ if args.kind == "judge":
50
+ return _record_judge(raw, args)
51
+ return _record_qg(raw, args)
52
+
53
+
54
+ def _record_qg(raw: str, args: argparse.Namespace) -> int:
55
+ try:
56
+ verdict = QGVerdict.model_validate(json.loads(raw))
57
+ except (json.JSONDecodeError, ValidationError) as exc:
58
+ print(f"error: invalid QGVerdict JSON — {exc}", file=sys.stderr)
59
+ return 1
60
+ record_verdict_label(
61
+ verdict,
62
+ deliverable=args.deliverable,
63
+ department=args.department,
64
+ eval_task_id=args.eval_task_id,
65
+ session_id=args.session_id,
66
+ )
67
+ print(json.dumps({
68
+ "recorded": True,
69
+ "verdict": verdict.verdict,
70
+ "eval_task_id": args.eval_task_id,
71
+ }))
72
+ return 0
73
+
74
+
75
+ def _record_judge(raw: str, args: argparse.Namespace) -> int:
76
+ try:
77
+ verdict = JudgeVerdict.model_validate(json.loads(raw))
78
+ except (json.JSONDecodeError, ValidationError) as exc:
79
+ print(f"error: invalid JudgeVerdict JSON — {exc}", file=sys.stderr)
80
+ return 1
81
+ record_judge_label(
82
+ verdict,
83
+ deliverable=args.deliverable,
84
+ department=args.department,
85
+ session_id=args.session_id,
86
+ )
87
+ print(json.dumps({
88
+ "recorded": True,
89
+ "verdict": verdict.verdict,
90
+ "gate": verdict.gate,
91
+ }))
92
+ return 0
93
+
94
+
95
+ if __name__ == "__main__":
96
+ raise SystemExit(main())
@@ -0,0 +1,102 @@
1
+ """Eval runner CLI — list tasks, corpus status, dispatch-ready prompts.
2
+
3
+ Evals reuse the Quality Gate as the judge (ADR 2026-07-09): a run is
4
+ the orchestrator dispatching a task prompt through the normal squad
5
+ flow, then recording the QGVerdict with the task id via
6
+ ``core.evals.record_cli``. This CLI is the deterministic half — it
7
+ never invokes models itself.
8
+
9
+ Usage:
10
+ arka-py -m core.evals.runner_cli list [--department dev]
11
+ arka-py -m core.evals.runner_cli status
12
+ arka-py -m core.evals.runner_cli prompt <task-id>
13
+ """
14
+
15
+ from __future__ import annotations
16
+
17
+ import argparse
18
+ import sys
19
+
20
+ from core.evals.schema import EvalTask, load_eval_tasks
21
+ from core.evals.verdict_labels import load_verdict_labels
22
+
23
+ DISTILLATION_LABEL_GATE = 500 # ADR 2026-07-09-evals-and-distillation
24
+
25
+
26
+ def _cmd_list(department: str | None) -> int:
27
+ tasks = load_eval_tasks()
28
+ if department:
29
+ tasks = [t for t in tasks if t.department == department]
30
+ for task in tasks:
31
+ print(f"{task.id:35s} {task.department:10s} {task.prompt[:60].strip()}…")
32
+ print(f"\n{len(tasks)} task(s)")
33
+ return 0
34
+
35
+
36
+ def _cmd_status() -> int:
37
+ labels = load_verdict_labels()
38
+ verdicts = [str(entry.get("verdict", "")) for entry in labels]
39
+ by_dept: dict[str, int] = {}
40
+ linked = 0
41
+ for entry in labels:
42
+ dept = str(entry.get("department") or "(none)")
43
+ by_dept[dept] = by_dept.get(dept, 0) + 1
44
+ if entry.get("eval_task_id"):
45
+ linked += 1
46
+ total = len(labels)
47
+ print(f"labels: {total} (gate: {DISTILLATION_LABEL_GATE} — "
48
+ f"{max(0, DISTILLATION_LABEL_GATE - total)} to go)")
49
+ print(f" APPROVED: {verdicts.count('APPROVED')} "
50
+ f"REJECTED: {verdicts.count('REJECTED')}")
51
+ print(f" linked to eval tasks: {linked}")
52
+ for dept, count in sorted(by_dept.items()):
53
+ print(f" {dept}: {count}")
54
+ print(f"eval tasks defined: {len(load_eval_tasks())}")
55
+ return 0
56
+
57
+
58
+ def _dispatch_prompt(task: EvalTask) -> str:
59
+ properties = "\n".join(f"- {p}" for p in task.expected_properties)
60
+ rubric = f"\nRubrica adicional: {task.rubric}" if task.rubric else ""
61
+ return (
62
+ f"[EVAL RUN — task {task.id}]\n"
63
+ f"Departamento: {task.department}\n\n"
64
+ f"Tarefa: {task.prompt}\n\n"
65
+ f"O deliverable será julgado pelo Quality Gate contra estas "
66
+ f"propriedades verificáveis:\n{properties}{rubric}\n\n"
67
+ f"Após o verdict, regista o label com:\n"
68
+ f" arka-py -m core.evals.record_cli --eval-task-id {task.id} "
69
+ f"--department {task.department} < verdict.json"
70
+ )
71
+
72
+
73
+ def _cmd_prompt(task_id: str) -> int:
74
+ tasks = {t.id: t for t in load_eval_tasks()}
75
+ task = tasks.get(task_id)
76
+ if task is None:
77
+ print(f"error: unknown eval task {task_id!r}; run `list`",
78
+ file=sys.stderr)
79
+ return 1
80
+ print(_dispatch_prompt(task))
81
+ return 0
82
+
83
+
84
+ def main(argv: list[str] | None = None) -> int:
85
+ parser = argparse.ArgumentParser(description=__doc__)
86
+ sub = parser.add_subparsers(dest="cmd", required=True)
87
+ p_list = sub.add_parser("list")
88
+ p_list.add_argument("--department")
89
+ sub.add_parser("status")
90
+ p_prompt = sub.add_parser("prompt")
91
+ p_prompt.add_argument("task_id")
92
+ args = parser.parse_args(argv)
93
+
94
+ if args.cmd == "list":
95
+ return _cmd_list(args.department)
96
+ if args.cmd == "status":
97
+ return _cmd_status()
98
+ return _cmd_prompt(args.task_id)
99
+
100
+
101
+ if __name__ == "__main__":
102
+ raise SystemExit(main())