arkaos 2.44.0 → 2.46.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/VERSION CHANGED
@@ -1 +1 @@
1
- 2.44.0
1
+ 2.46.0
package/arka/SKILL.md CHANGED
@@ -185,10 +185,10 @@ violation (squad-routing, arka-supremacy, spec-driven, mandatory-qa).
185
185
 
186
186
  | Command | Description |
187
187
  |---------|-------------|
188
- | `/arka status` | System status (version, departments, agents, active projects). Includes **LLM costs (24h)** section: top-line cost + cache hit rate + call count from `core.runtime.llm_cost_telemetry.summarise(period="today")`. Also includes **Enforcement (24h)** section: total calls, block rate, top blocked tools/reasons from `core.governance.enforcement_telemetry.summarise(period="today")` (PR19 v2.41.0). |
188
+ | `/arka status` | System status (version, departments, agents, active projects). Includes **LLM costs (24h)** section: top-line cost + cache hit rate + call count from `core.runtime.llm_cost_telemetry.summarise(period="today")`. Also includes **Enforcement (24h)** section: total calls, block rate, top blocked tools/reasons from `core.governance.enforcement_telemetry.summarise(period="today")` (PR19 v2.41.0). Plus **Reorganization (today)** section: today's proposal path + artifact count from `core.cognition.reorganizer_scheduler.status_summary()` (PR24 v2.46.0). |
189
189
  | `/arka costs [period]` | LLM cost visibility — aggregates telemetry by day/week/month/all, with top expensive sessions. See `arka/skills/costs/SKILL.md`. Shells out to `python -m core.runtime.llm_cost_telemetry_cli <period>`. |
190
190
  | `/arka enforcement [period]` | Enforcement compliance — aggregates flow-marker enforcement telemetry by day/week/month/all. Shows block rate, top blocked tools, top reasons. Shells out to `python -m core.governance.enforcement_telemetry_cli <period>`. |
191
- | `/arka reorganize [--since-days N]` | Dreaming → Agent reorganizer. Aggregates recent KB pattern/anti-pattern/lesson artifacts (default last 7 days) into a markdown proposal at `~/.arkaos/reorganize-proposals/<date>.md`. **Propose-only** — never modifies agent YAMLs. Sanitizes client identifiers from titles and body excerpts; drops `tags:` field entirely to prevent project-name leaks. Shells out to `python -m core.cognition.reorganizer_cli [--since-days N] [--dry-run]`. |
191
+ | `/arka reorganize [--since-days N]` | Dreaming → Agent reorganizer. Aggregates recent KB pattern/anti-pattern/lesson artifacts (default last 7 days) into a markdown proposal at `~/.arkaos/reorganize-proposals/<date>.md`. **Propose-only** — never modifies agent YAMLs. Sanitizes client identifiers from titles and body excerpts; drops `tags:` field entirely to prevent project-name leaks. **Auto-fires on session start when today's proposal is missing** (PR24 v2.46.0 stale-aware trigger, 30s timeout, background). Shells out to `python -m core.cognition.reorganizer_cli [--since-days N] [--dry-run]`. |
192
192
  | `/arka standup` | Daily standup (projects, priorities, blockers, updates) |
193
193
  | `/arka monitor` | System health monitoring |
194
194
  | `/arka onboard <path>` | Onboard an existing project into ArkaOS |
@@ -107,6 +107,21 @@ MSG+="\\nFields: kb=N (Obsidian/KB notes consulted), research=X (MCPs invoked: p
107
107
  MSG+="\\nMandatory after: EFFECT tool calls, plan/recommendation outputs, QG verdicts. Optional for pure read-only status replies."
108
108
  MSG+="\\nAbsence is measured by the Stop hook (warn-only in v2.34.0) before promotion to hard enforcement."
109
109
 
110
+ # ─── Stale-aware reorganizer trigger (PR24 v2.46.0) ─────────────────────
111
+ # If today's proposal file is missing, fire the reorganizer in the
112
+ # background with a 30s timeout. Best-effort, never blocks session
113
+ # start. Multiple sessions per day no-op because the file now exists.
114
+ if [ -n "$REPO" ] && command -v python3 &>/dev/null; then
115
+ _PROPOSAL_DIR="$HOME/.arkaos/reorganize-proposals"
116
+ _TODAY="$(date -u +%Y-%m-%d).md"
117
+ if [ ! -f "$_PROPOSAL_DIR/$_TODAY" ]; then
118
+ (
119
+ cd "$REPO" && timeout 30s python3 -m core.cognition.reorganizer_cli >/dev/null 2>&1
120
+ ) &
121
+ disown 2>/dev/null || true
122
+ fi
123
+ fi
124
+
110
125
  # --- Session Memory Resume Context ---
111
126
  if command -v python3 &>/dev/null && [ -n "$REPO" ]; then
112
127
  _SESSION_CTX=$(cd "$REPO" && python3 -c "
@@ -0,0 +1,106 @@
1
+ """Stale-aware reorganizer scheduler (PR24 v2.46.0).
2
+
3
+ Cron-less. The trigger is file existence: when today's proposal file
4
+ isn't on disk, ``is_stale`` returns True and the session-start hook
5
+ fires the reorganizer in background. Multiple sessions per day no-op
6
+ because the proposal file now exists.
7
+
8
+ Read-only — the actual generation lives in
9
+ ``core.cognition.reorganizer.build_proposal``. This module only
10
+ inspects state and renders status.
11
+ """
12
+
13
+ from __future__ import annotations
14
+
15
+ import re
16
+ from dataclasses import dataclass
17
+ from datetime import datetime, timezone
18
+ from pathlib import Path
19
+
20
+ _DEFAULT_PROPOSAL_DIR = Path.home() / ".arkaos" / "reorganize-proposals"
21
+ _ARTIFACT_COUNT_RE = re.compile(r"Artifacts:\s*\*\*(\d+)\*\*")
22
+
23
+
24
+ @dataclass(frozen=True)
25
+ class SchedulerStatus:
26
+ """Snapshot of the reorganizer's daily-proposal state."""
27
+ today_proposal_exists: bool
28
+ today_proposal_path: Path
29
+ last_generated_at: str | None
30
+ artifact_count: int | None
31
+
32
+
33
+ def is_stale(*, output_dir: Path | None = None) -> bool:
34
+ """Return True iff today's proposal file is missing."""
35
+ path = _today_proposal_path(output_dir)
36
+ return not path.is_file()
37
+
38
+
39
+ def status_summary(*, output_dir: Path | None = None) -> SchedulerStatus:
40
+ """Return the current scheduler snapshot for /arka status."""
41
+ path = _today_proposal_path(output_dir)
42
+ if not path.is_file():
43
+ return SchedulerStatus(
44
+ today_proposal_exists=False,
45
+ today_proposal_path=path,
46
+ last_generated_at=None,
47
+ artifact_count=None,
48
+ )
49
+ mtime = _format_mtime(path)
50
+ count = _parse_artifact_count(path)
51
+ return SchedulerStatus(
52
+ today_proposal_exists=True,
53
+ today_proposal_path=path,
54
+ last_generated_at=mtime,
55
+ artifact_count=count,
56
+ )
57
+
58
+
59
+ def render_status_md(status: SchedulerStatus) -> str:
60
+ """Render a SchedulerStatus as a markdown block for /arka status."""
61
+ if not status.today_proposal_exists:
62
+ return (
63
+ "## Reorganization (today)\n\n"
64
+ "No proposal generated yet — will fire on next session start."
65
+ )
66
+ lines = [
67
+ "## Reorganization (today)",
68
+ "",
69
+ f"- Proposal: `{status.today_proposal_path}`",
70
+ ]
71
+ if status.last_generated_at:
72
+ lines.append(f"- Generated: {status.last_generated_at}")
73
+ if status.artifact_count is not None:
74
+ lines.append(f"- Artifacts surfaced: **{status.artifact_count}**")
75
+ return "\n".join(lines)
76
+
77
+
78
+ def _today_iso() -> str:
79
+ return datetime.now(timezone.utc).strftime("%Y-%m-%d")
80
+
81
+
82
+ def _today_proposal_path(output_dir: Path | None) -> Path:
83
+ base = Path(output_dir) if output_dir is not None else _DEFAULT_PROPOSAL_DIR
84
+ return base / f"{_today_iso()}.md"
85
+
86
+
87
+ def _format_mtime(path: Path) -> str | None:
88
+ try:
89
+ ts = datetime.fromtimestamp(path.stat().st_mtime, tz=timezone.utc)
90
+ return ts.isoformat(timespec="seconds")
91
+ except OSError:
92
+ return None
93
+
94
+
95
+ def _parse_artifact_count(path: Path) -> int | None:
96
+ try:
97
+ text = path.read_text(encoding="utf-8", errors="replace")
98
+ except OSError:
99
+ return None
100
+ match = _ARTIFACT_COUNT_RE.search(text)
101
+ if not match:
102
+ return None
103
+ try:
104
+ return int(match.group(1))
105
+ except ValueError:
106
+ return None
@@ -106,21 +106,13 @@ def _format_leak_check_result(report) -> CheckResult:
106
106
  reason=f"{report.files_scanned} file(s) scanned, no leaks",
107
107
  )
108
108
  first = report.hits[0]
109
- # PR22 v2.44.0 introduces this check at WARNING severity to ship the
110
- # scanner without blocking on pre-existing leaks in test fixtures
111
- # (test_dreaming.py and siblings) + historical CHANGELOG/ADR
112
- # references. PR23 cleans those up and flips severity to "blocking".
113
109
  return CheckResult(
114
- name="no-client-name-leaks", passed=False, severity="warning",
110
+ name="no-client-name-leaks", passed=False, severity="blocking",
115
111
  reason=(
116
112
  f"{len(report.hits)} leak(s) — first: "
117
113
  f"{first.path.name}:{first.line_number} matched `{first.matched_token}`"
118
114
  ),
119
- remediation=(
120
- "move the literal to ~/.arkaos/ or sanitize before commit; "
121
- "PR22 scope intentionally warning-only — PR23 will scrub "
122
- "historical leaks and flip this check to blocking"
123
- ),
115
+ remediation="move the literal to ~/.arkaos/ or sanitize before commit",
124
116
  )
125
117
 
126
118
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arkaos",
3
- "version": "2.44.0",
3
+ "version": "2.46.0",
4
4
  "description": "The Operating System for AI Agent Teams",
5
5
  "type": "module",
6
6
  "bin": {
package/pyproject.toml CHANGED
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "arkaos-core"
3
- version = "2.44.0"
3
+ version = "2.46.0"
4
4
  description = "Core engine for ArkaOS — The Operating System for AI Agent Teams"
5
5
  readme = "README.md"
6
6
  license = {text = "MIT"}