arkaos 4.37.0 → 4.39.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 (81) hide show
  1. package/README.md +1 -1
  2. package/THE-ARKAOS-GUIDE.md +1 -1
  3. package/VERSION +1 -1
  4. package/arka/SKILL.md +1 -1
  5. package/config/hooks/cwd-changed.ps1 +11 -5
  6. package/config/hooks/cwd-changed.sh +11 -4
  7. package/config/hooks/session-start.sh +25 -1
  8. package/config/hooks/user-prompt-submit.ps1 +9 -7
  9. package/config/hooks/user-prompt-submit.sh +3 -2
  10. package/config/settings-template.json +1 -1
  11. package/config/skills-curated.yaml +2 -2
  12. package/config/skills-provenance.yaml +7 -0
  13. package/core/governance/evidence_checks.py +33 -3
  14. package/core/governance/reviewer_ledger.py +708 -0
  15. package/core/hooks/_shared.py +20 -0
  16. package/core/hooks/post_tool_use.py +78 -25
  17. package/core/hooks/session_end.py +16 -0
  18. package/core/hooks/session_start.py +79 -16
  19. package/core/hooks/stop.py +38 -0
  20. package/core/hooks/subagent_stop.py +158 -17
  21. package/core/hooks/user_prompt_submit.py +230 -81
  22. package/core/memory/semantic_store.py +58 -11
  23. package/core/memory/turn_capture.py +56 -11
  24. package/core/runtime/opencode.py +2 -2
  25. package/core/runtime/opencode_hooks.py +188 -3
  26. package/core/synapse/engine.py +2 -2
  27. package/dashboard/nuxt.config.ts +6 -0
  28. package/departments/dev/skills/animated-website/SKILL.md +4 -2
  29. package/departments/dev/skills/scroll-world/SKILL.md +619 -0
  30. package/departments/dev/skills/scroll-world/references/index-template.html +73 -0
  31. package/departments/dev/skills/scroll-world/references/knockout.py +89 -0
  32. package/departments/dev/skills/scroll-world/references/pipeline.md +213 -0
  33. package/departments/dev/skills/scroll-world/references/prompts.md +149 -0
  34. package/departments/dev/skills/scroll-world/references/scroll-world.LICENSE +21 -0
  35. package/departments/dev/skills/scroll-world/references/scrub-engine.js +448 -0
  36. package/departments/ops/skills/hookify/SKILL.md +7 -4
  37. package/harness/codex/AGENTS.md +1 -1
  38. package/harness/copilot/copilot-instructions.md +1 -1
  39. package/harness/cursor/rules/arkaos.mdc +2 -2
  40. package/harness/gemini/GEMINI.md +1 -1
  41. package/harness/opencode/AGENTS.md +1 -1
  42. package/harness/opencode/agents/arka-architect-gabriel.md +1 -1
  43. package/harness/opencode/agents/arka-brand-director-valentina.md +1 -1
  44. package/harness/opencode/agents/arka-cfo-helena.md +1 -1
  45. package/harness/opencode/agents/arka-chief-of-staff-afonso.md +1 -1
  46. package/harness/opencode/agents/arka-community-strategist-beatriz.md +1 -1
  47. package/harness/opencode/agents/arka-content-strategist-rafael.md +1 -1
  48. package/harness/opencode/agents/arka-conversion-strategist-ines.md +1 -1
  49. package/harness/opencode/agents/arka-coo-sofia.md +1 -1
  50. package/harness/opencode/agents/arka-copy-director-eduardo.md +1 -1
  51. package/harness/opencode/agents/arka-cqo-marta.md +1 -1
  52. package/harness/opencode/agents/arka-cto-marco.md +1 -1
  53. package/harness/opencode/agents/arka-design-ops-lead-iris.md +1 -1
  54. package/harness/opencode/agents/arka-ecom-director-ricardo.md +1 -1
  55. package/harness/opencode/agents/arka-knowledge-director-clara.md +1 -1
  56. package/harness/opencode/agents/arka-leadership-director-rodrigo.md +1 -1
  57. package/harness/opencode/agents/arka-marketing-director-luna.md +1 -1
  58. package/harness/opencode/agents/arka-ops-lead-daniel.md +1 -1
  59. package/harness/opencode/agents/arka-pm-director-carolina.md +1 -1
  60. package/harness/opencode/agents/arka-revops-lead-vicente.md +1 -1
  61. package/harness/opencode/agents/arka-saas-strategist-tiago.md +1 -1
  62. package/harness/opencode/agents/arka-sales-director-miguel.md +1 -1
  63. package/harness/opencode/agents/arka-strategy-director-tomas.md +1 -1
  64. package/harness/opencode/agents/arka-tech-director-francisca.md +1 -1
  65. package/harness/opencode/agents/arka-tech-lead-paulo.md +1 -1
  66. package/harness/opencode/agents/arka-video-producer-simao.md +1 -1
  67. package/harness/opencode/plugins/arka.ts +15 -0
  68. package/harness/zed/.rules +1 -1
  69. package/installer/adapters/claude-code.js +6 -2
  70. package/installer/assets/opencode/arka.ts +15 -0
  71. package/installer/doctor.js +21 -0
  72. package/knowledge/commands-registry.json.bak +705 -98
  73. package/knowledge/skills-manifest.json +14 -1
  74. package/package.json +1 -1
  75. package/pyproject.toml +1 -1
  76. package/scripts/start-dashboard.ps1 +42 -2
  77. package/scripts/synapse-bridge.py +1 -1
  78. package/scripts/tools/prompt_surface_benchmark.py +8 -6
  79. package/config/hooks/post-tool-use-v2.sh +0 -120
  80. package/config/hooks/pre-compact-v2.sh +0 -43
  81. package/config/hooks/user-prompt-submit-v2.sh +0 -159
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  **The Operating System for AI Agent Teams.**
4
4
 
5
- 89 agents. 17 departments. 331 skills. Enterprise frameworks. Multi-runtime. One install.
5
+ 89 agents. 17 departments. 332 skills. Enterprise frameworks. Multi-runtime. One install.
6
6
 
7
7
  ```bash
8
8
  npx arkaos install
@@ -1,6 +1,6 @@
1
1
  # The ArkaOS Guide
2
2
 
3
- > v4.36.0 — 89 agents, 17 departments, 331 skills, 297 commands, 17 ADRs.
3
+ > v4.39.0 — 89 agents, 17 departments, 332 skills, 297 commands, 17 ADRs.
4
4
  > One file, everything you need to start. Generated by `scripts/guide_gen.py` — never hand-edited.
5
5
 
6
6
  ## What it is
package/VERSION CHANGED
@@ -1 +1 @@
1
- 4.37.0
1
+ 4.39.0
package/arka/SKILL.md CHANGED
@@ -47,7 +47,7 @@ complementary, not alternatives.
47
47
  # ArkaOS — Main Orchestrator
48
48
 
49
49
  > **The Operating System for AI Agent Teams**
50
- > 89 agents. 17 departments. 331 skills. Multi-runtime. Dashboard. Knowledge RAG.
50
+ > 89 agents. 17 departments. 332 skills. Multi-runtime. Dashboard. Knowledge RAG.
51
51
 
52
52
  ## ⛔ Evidence flow — 4 gates (NON-NEGOTIABLE)
53
53
 
@@ -2,13 +2,17 @@
2
2
  # ArkaOS — CwdChanged Hook (Windows / PowerShell 5.1+)
3
3
  #
4
4
  # Port of config/hooks/cwd-changed.sh. Fires when the working directory
5
- # changes. Detects ecosystem and stack so Claude knows which squad and
6
- # tooling apply to the project.
5
+ # changes. Detects the ecosystem/stack and surfaces them to the operator
6
+ # as a system message.
7
7
  #
8
8
  # Contract:
9
9
  # - Reads a JSON object on stdin with a `cwd` field.
10
- # - Emits `{"additionalContext": "..."}` on stdout when context is found,
11
- # or nothing (and exit 0) when there is nothing to say.
10
+ # - Emits `{"systemMessage": "..."}` on stdout when context is found, or
11
+ # nothing (and exit 0) when there is nothing to say. CwdChanged's
12
+ # hookSpecificOutput accepts watchPaths only (Claude Code 2.1.220) —
13
+ # additionalContext is unreachable on this event. On later prompts the
14
+ # cwd-reading Synapse layers refresh (git branch, graph context,
15
+ # knowledge retrieval, cwd-scoped session memory).
12
16
  # ============================================================================
13
17
 
14
18
  $ErrorActionPreference = 'Stop'
@@ -148,5 +152,7 @@ if ($descriptor) {
148
152
  }
149
153
 
150
154
  if ($context) {
151
- [pscustomobject]@{ additionalContext = $context } | ConvertTo-Json -Compress
155
+ # CwdChanged accepts no additionalContext (watchPaths only) — the
156
+ # top-level systemMessage is the one deliverable surface on this event.
157
+ [pscustomobject]@{ systemMessage = $context } | ConvertTo-Json -Compress
152
158
  }
@@ -1,8 +1,10 @@
1
1
  #!/usr/bin/env bash
2
2
  # ============================================================================
3
3
  # ArkaOS — CwdChanged Hook
4
- # Fires when the working directory changes. Detects ecosystem and injects
5
- # project context so Claude knows which squad and stack to use.
4
+ # Fires when the working directory changes. Detects the ecosystem/stack
5
+ # and surfaces a systemMessage naming them (the one deliverable surface
6
+ # on this event — CwdChanged's hookSpecificOutput accepts watchPaths
7
+ # only).
6
8
  # ============================================================================
7
9
 
8
10
  input=$(cat)
@@ -116,7 +118,12 @@ if [ -n "$DESCRIPTOR" ]; then
116
118
  fi
117
119
 
118
120
  if [ -n "$CONTEXT" ]; then
119
- # Build the JSON with jq so any quote/backslash in the ecosystem name or
121
+ # CwdChanged's hookSpecificOutput accepts watchPaths ONLY (Claude Code
122
+ # 2.1.220 schema) — additionalContext is unreachable on this event. The
123
+ # top-level systemMessage key IS consumed and surfaced to the operator.
124
+ # On later prompts the cwd-reading Synapse layers refresh (git branch,
125
+ # graph context, knowledge retrieval, cwd-scoped session memory).
126
+ # Built with jq so any quote/backslash in the ecosystem name or
120
127
  # descriptor path is escaped, never breaking the envelope (OWASP A03).
121
- jq -nc --arg ctx "$CONTEXT" '{additionalContext: $ctx}'
128
+ jq -nc --arg msg "$CONTEXT" '{systemMessage: $msg}'
122
129
  fi
@@ -18,8 +18,32 @@ export ARKA_HOOK_CWD="$_HOOK_CWD"
18
18
  _ARKA_LIB="$(dirname "${BASH_SOURCE[0]:-$0}")/_lib/arka_python.sh"
19
19
  if [ -f "$_ARKA_LIB" ]; then . "$_ARKA_LIB"; else ARKA_PY="python3"; fi
20
20
 
21
+ # ─── Resolve the root via the shared resolver (one root per session) ───
22
+ # Reading .repo-path raw diverged from every other hook: the file points
23
+ # at an npx cache that `npm cache clean` can purge, while
24
+ # arka_resolve_root falls through to the ~/.arkaos/lib snapshot. The
25
+ # chosen root AND source both travel to the entrypoint so the session
26
+ # can name the root it actually ran from ([arka:root]).
21
27
  REPO=""
22
- [ -f "$HOME/.arkaos/.repo-path" ] && REPO=$(cat "$HOME/.arkaos/.repo-path")
28
+ ARKA_ROOT_SOURCE="legacy"
29
+ if command -v arka_resolve_root >/dev/null 2>&1; then
30
+ [ -n "${ARKAOS_ROOT:-}" ] && ARKA_ROOT_SOURCE="env"
31
+ REPO="$(arka_resolve_root)"
32
+ if [ "$ARKA_ROOT_SOURCE" != "env" ]; then
33
+ if [ -f "$HOME/.arkaos/.repo-path" ] \
34
+ && [ "$REPO" = "$(cat "$HOME/.arkaos/.repo-path" 2>/dev/null)" ]; then
35
+ ARKA_ROOT_SOURCE="repo-path"
36
+ elif [ "$REPO" = "$HOME/.arkaos/lib" ]; then
37
+ ARKA_ROOT_SOURCE="lib-snapshot"
38
+ else
39
+ ARKA_ROOT_SOURCE="fallback"
40
+ fi
41
+ fi
42
+ elif [ -f "$HOME/.arkaos/.repo-path" ]; then
43
+ REPO=$(cat "$HOME/.arkaos/.repo-path")
44
+ fi
45
+ export ARKA_ROOT_SOURCE
46
+ export ARKA_ROOT="$REPO"
23
47
 
24
48
  # The MODULE file is the guard, not just core/: an older installed
25
49
  # snapshot without it would exec into "No module named ..." (exit 1,
@@ -1,17 +1,19 @@
1
1
  # ============================================================================
2
2
  # ArkaOS v2 - UserPromptSubmit Hook (Synapse Bridge) (Windows / PowerShell 5.1+)
3
3
  #
4
- # Port of config/hooks/user-prompt-submit.sh. Calls the Python Synapse bridge
5
- # for 8-layer context injection, with a pure-PowerShell fallback for
6
- # installations where Python is unavailable or the bridge is missing.
4
+ # Port of config/hooks/user-prompt-submit.sh. Calls the Python Synapse
5
+ # bridge for layered context injection, with a pure-PowerShell fallback
6
+ # for installations where Python is unavailable or the bridge is missing.
7
7
  #
8
8
  # Contract:
9
9
  # - Reads a JSON payload from stdin (userInput / message / raw).
10
10
  # - Emits a single-line JSON object on stdout:
11
- # {"additionalContext": "<sync-notice><synapse-or-fallback>"}
11
+ # {"hookSpecificOutput": {"hookEventName": "UserPromptSubmit",
12
+ # "additionalContext": "<sync-notice><route-reminder> <synapse-or-fallback>"}}
13
+ # (a top-level additionalContext key is ignored by Claude Code)
12
14
  # - Side effect: writes one line to the cache metrics JSONL.
13
15
  #
14
- # Target latency: <100ms (hook timeout is 10s in settings).
16
+ # Target latency: <100ms (hook timeout is 20s in settings).
15
17
  #
16
18
  # File is pure ASCII. Any typographic characters that need to appear in the
17
19
  # output are built from [char] codes at runtime so PS 5.1's default ANSI
@@ -54,7 +56,7 @@ if (-not $v2Installed) {
54
56
  foreach ($v1 in $v1Paths) {
55
57
  if ((Test-Path -LiteralPath $v1 -PathType Container) -and -not (Test-Path -LiteralPath $migrationMarker)) {
56
58
  $msg = "[MIGRATION] ArkaOS v1 detected at $v1. Run: npx arkaos migrate - This will backup v1, preserve your data, and install v2. See: https://github.com/andreagroferreira/arka-os#install"
57
- [pscustomobject]@{ additionalContext = $msg } | ConvertTo-Json -Compress
59
+ [pscustomobject]@{ hookSpecificOutput = [pscustomobject]@{ hookEventName = 'UserPromptSubmit'; additionalContext = $msg } } | ConvertTo-Json -Compress -Depth 4
58
60
  exit 0
59
61
  }
60
62
  }
@@ -336,7 +338,7 @@ $routeReminder = '[arka:route] Every response MUST route through a department sq
336
338
 
337
339
  # --- Output ----------------------------------------------------------------
338
340
  $additionalContext = "$syncNotice$routeReminder $pythonResult"
339
- [pscustomobject]@{ additionalContext = $additionalContext } | ConvertTo-Json -Compress
341
+ [pscustomobject]@{ hookSpecificOutput = [pscustomobject]@{ hookEventName = 'UserPromptSubmit'; additionalContext = $additionalContext } } | ConvertTo-Json -Compress -Depth 4
340
342
 
341
343
  # --- Metrics (JSONL append) ------------------------------------------------
342
344
  $elapsed = [int]$sw.ElapsedMilliseconds
@@ -20,7 +20,8 @@
20
20
  # - One-shot nudges (KB-cite, meta-tag, closing-marker) gated by
21
21
  # effort level; cognitive context injection.
22
22
  #
23
- # Timeout: 10s | Output: JSON to stdout | Target: <100ms
23
+ # Timeout: 20 s (in-hook budget ARKA_UPS_BUDGET_MS, default 6000 ms)
24
+ # Output: JSON to stdout | Target: <100ms
24
25
  # ============================================================================
25
26
 
26
27
  # ─── Shared Python resolver (exports ARKA_PY) ──────────────────────────
@@ -44,7 +45,7 @@ elif [ -z "${ARKAOS_ROOT:-}" ]; then
44
45
  fi
45
46
  export ARKAOS_ROOT
46
47
 
47
- _ARKA_L0_FALLBACK='{"additionalContext": "[Constitution] NON-NEGOTIABLE: branch-isolation, security-gate, mandatory-qa, evidence-flow, arkaos-not-yes-man, excellence-mandate | QUALITY-GATE: marta-cqo, eduardo-copy, francisca-tech-ux | MUST (28) incl.: squad-routing, spec-driven, conventional-commits, test-coverage, subagent-discipline, persona-vs-artifact"}'
48
+ _ARKA_L0_FALLBACK='{"hookSpecificOutput": {"hookEventName": "UserPromptSubmit", "additionalContext": "[Constitution] NON-NEGOTIABLE: branch-isolation, security-gate, mandatory-qa, evidence-flow, arkaos-not-yes-man, excellence-mandate | QUALITY-GATE: marta-cqo, eduardo-copy, francisca-tech-ux | MUST (28) incl.: squad-routing, spec-driven, conventional-commits, test-coverage, subagent-discipline, persona-vs-artifact"}}'
48
49
 
49
50
  # Test seam: bats asserts the fallback CONTENT deterministically —
50
51
  # the shared resolver overwrites ARKA_PY, so an env flag is the only
@@ -25,7 +25,7 @@
25
25
  {
26
26
  "type": "command",
27
27
  "command": "{{HOOKS_DIR}}/user-prompt-submit.sh",
28
- "timeout": 10
28
+ "timeout": 20
29
29
  }
30
30
  ]
31
31
  }
@@ -24,8 +24,8 @@ curated_subskills:
24
24
  community: [moderation]
25
25
  content: [calendar, hook-write]
26
26
  dev: [api-design, architecture-design, clean-code-review, code-review,
27
- db-design, diagram, refactor-plan, runbook, security-audit, spec,
28
- tdd-cycle, watch]
27
+ db-design, diagram, refactor-plan, runbook, scroll-world,
28
+ security-audit, spec, tdd-cycle, watch]
29
29
  ecom: [cart-recovery, store-audit]
30
30
  finance: [financial-model, unit-economics]
31
31
  kb: [search-kb, zettelkasten-process]
@@ -91,6 +91,13 @@ derived:
91
91
  origin: community
92
92
  source: https://github.com/nutlope/hallmark
93
93
  license: MIT
94
+ # Scroll-world — scroll-scrubbed "fly through the world" landing pages
95
+ # (Higgsfield pipeline + portable scrub engine), vendored verbatim with
96
+ # ArkaOS frontmatter; THIRD-PARTY-NOTICES records the trail.
97
+ departments/dev/skills/scroll-world:
98
+ origin: community
99
+ source: https://github.com/oso95/scroll-world
100
+ license: MIT
94
101
  # Watch absorption campaign — video-input primitive derived from
95
102
  # bradautomates/claude-video v0.2.0 (MIT), maintained natively.
96
103
  departments/dev/skills/watch:
@@ -390,24 +390,54 @@ def _foreign_pytest_can_collect(
390
390
  return probe.returncode in (0, 5)
391
391
 
392
392
 
393
+ def _degrade_pytest_no_tests(result: CheckResult) -> CheckResult:
394
+ """Map pytest exit 5 (no tests collected) to insufficient evidence.
395
+
396
+ A bare ``pytest`` in a Python project that ships no tests exits 5.
397
+ Absence of tests is not evidence of FAILURE, yet ``passed =
398
+ returncode == 0`` read exit 5 as FAIL and ``_derive_overall`` then
399
+ forced REJECTED at the QG (issue #354). ``_foreign_pytest_can_collect``
400
+ already treats exit 5 as a valid import path — this keeps that
401
+ precedent for the verdict: exit 5 becomes ``passed=None``
402
+ (non-conclusive), never ``False``.
403
+ """
404
+ if result.exit_code != 5:
405
+ return result
406
+ prefix = "no tests collected (pytest exit 5) — insufficient evidence; "
407
+ return replace(result, passed=None, summary=prefix + result.summary)
408
+
409
+
393
410
  def _check_tests(
394
411
  project_dir: Path, changed: list[str] | None,
395
412
  test_command: str | None, timeout: int,
396
413
  ) -> CheckResult:
397
414
  if test_command:
398
- return _run("tests", shlex.split(test_command), project_dir, timeout)
415
+ argv = shlex.split(test_command)
416
+ result = _run("tests", argv, project_dir, timeout)
417
+ # exit 5 is pytest's "no tests collected"; scan the first 3
418
+ # tokens so `python -m pytest` / `arka-py -m pytest` degrade too,
419
+ # while non-pytest runners (npm test) stay a real FAIL. Bounded to
420
+ # argv[:3] so a later test-path arg named *pytest* never matches
421
+ # (issue #354).
422
+ if any("pytest" in Path(tok).name for tok in argv[:3]):
423
+ return _degrade_pytest_no_tests(result)
424
+ return result
399
425
  if _has_python(project_dir, changed):
400
426
  local_pytest = _project_pytest(project_dir)
401
427
  if local_pytest:
402
428
  return _labelled(
403
- _run("tests", [*local_pytest, "-q"], project_dir, timeout),
429
+ _degrade_pytest_no_tests(
430
+ _run("tests", [*local_pytest, "-q"], project_dir, timeout),
431
+ ),
404
432
  "tests(project-venv)",
405
433
  )
406
434
  pytest_cmd = _tool_cmd("pytest")
407
435
  if pytest_cmd and _foreign_pytest_can_collect(
408
436
  pytest_cmd, project_dir, timeout
409
437
  ):
410
- return _run("tests", [*pytest_cmd, "-q"], project_dir, timeout)
438
+ return _degrade_pytest_no_tests(
439
+ _run("tests", [*pytest_cmd, "-q"], project_dir, timeout),
440
+ )
411
441
  if pytest_cmd:
412
442
  return _skip(
413
443
  "tests",