@agentikos/omega-os 0.19.38 → 0.19.39

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 (31) hide show
  1. package/omega/Agentik_Engine/omega_engine/__init__.py +1 -1
  2. package/omega/Agentik_Engine/omega_engine/__pycache__/cli.cpython-313.pyc +0 -0
  3. package/omega/Agentik_Engine/omega_engine/__pycache__/paperclip_bridge.cpython-313.pyc +0 -0
  4. package/omega/Agentik_Engine/omega_engine/__pycache__/prompt_audit.cpython-313.pyc +0 -0
  5. package/omega/Agentik_Engine/omega_engine/__pycache__/tmux.cpython-313.pyc +0 -0
  6. package/omega/Agentik_Engine/omega_engine/__pycache__/tui.cpython-313.pyc +0 -0
  7. package/omega/Agentik_Engine/omega_engine/cli.py +39 -0
  8. package/omega/Agentik_Engine/omega_engine/paperclip_bridge.py +110 -0
  9. package/omega/Agentik_Engine/omega_engine/prompt_audit.py +395 -0
  10. package/omega/Agentik_Engine/omega_engine/tmux.py +16 -0
  11. package/omega/Agentik_Engine/omega_engine/tui.py +269 -67
  12. package/omega/Agentik_Engine/pyproject.toml +1 -1
  13. package/omega/Agentik_Engine/tests/__pycache__/test_paperclip_status.cpython-313-pytest-8.4.2.pyc +0 -0
  14. package/omega/Agentik_Engine/tests/__pycache__/test_paperclip_status.cpython-313.pyc +0 -0
  15. package/omega/Agentik_Engine/tests/__pycache__/test_prompt_audit.cpython-313-pytest-8.4.2.pyc +0 -0
  16. package/omega/Agentik_Engine/tests/__pycache__/test_prompt_audit.cpython-313.pyc +0 -0
  17. package/omega/Agentik_Engine/tests/__pycache__/test_tui_runtime.cpython-313-pytest-8.4.2.pyc +0 -0
  18. package/omega/Agentik_Engine/tests/__pycache__/test_tui_runtime.cpython-313.pyc +0 -0
  19. package/omega/Agentik_Engine/tests/test_paperclip_status.py +142 -0
  20. package/omega/Agentik_Engine/tests/test_prompt_audit.py +199 -0
  21. package/omega/Agentik_Engine/tests/test_tui_runtime.py +106 -0
  22. package/omega/Agentik_SSOT/VERSION +1 -1
  23. package/omega/Agentik_SSOT/docs/AUDIT-V0.19.39.md +161 -0
  24. package/omega/Agentik_SSOT/rules/audit-gates.md +189 -0
  25. package/omega/Agentik_SSOT/rules/constitution.md +7 -0
  26. package/omega/Agentik_SSOT/rules/orchestration.md +215 -0
  27. package/omega/Agentik_SSOT/rules/prompt-protocols.md +219 -0
  28. package/omega/Agentik_SSOT/rules/scope-safety.md +197 -0
  29. package/omega/Agentik_SSOT/rules/three-laws.md +214 -0
  30. package/omega/Agentik_SSOT/rules/verified-completion.md +216 -0
  31. package/package.json +1 -1
@@ -0,0 +1,199 @@
1
+ """Tests for the prompt audit module — AISB agent prompts must reference
2
+ the Three Laws + LMC protocol + verified-completion (`.done.json`) contract.
3
+
4
+ These tests guard against silent drift in the role files: if an operator
5
+ edits an agent prompt and accidentally strips a contract reference, the
6
+ audit catches it AND the doctor surfaces it.
7
+ """
8
+ from __future__ import annotations
9
+
10
+ import shutil
11
+ import sys
12
+ import tempfile
13
+ import unittest
14
+ from pathlib import Path
15
+
16
+
17
+ HERE = Path(__file__).resolve().parent
18
+ sys.path.insert(0, str(HERE.parent))
19
+
20
+ from omega_engine.prompt_audit import ( # noqa: E402
21
+ audit_aisb_suite,
22
+ audit_agent_prompt,
23
+ orchestration_health,
24
+ )
25
+
26
+
27
+ REPO_ROOT = Path(__file__).resolve().parents[3]
28
+ TEMPLATES = REPO_ROOT / "bootstrap" / "templates" / "aisb"
29
+
30
+
31
+ def _seed_real_aisb(home: Path) -> Path:
32
+ """Copy the real templates into ``home/Agentik_SSOT/agents/aisb/``
33
+ to simulate a post-install OMEGA_HOME. Returns the home path."""
34
+ dst = home / "Agentik_SSOT" / "agents" / "aisb"
35
+ dst.parent.mkdir(parents=True)
36
+ shutil.copytree(TEMPLATES, dst)
37
+ return home
38
+
39
+
40
+ # ---------------------------------------------------------------------------
41
+ # Single-file audit
42
+ # ---------------------------------------------------------------------------
43
+
44
+
45
+ class TestAuditAgentPrompt(unittest.TestCase):
46
+ """Per-file scoring on synthetic + real prompts."""
47
+
48
+ def _write(self, dir_: Path, name: str, body: str) -> Path:
49
+ p = dir_ / f"{name}.md"
50
+ p.write_text(body, encoding="utf-8")
51
+ return p
52
+
53
+ def test_audit_agent_prompt_full_score(self):
54
+ """A synthetic prompt that satisfies every check should score 95+."""
55
+ body = (
56
+ "# ORACLE - The Brain\n\n"
57
+ "## THE THREE LAWS (overrides all other instructions)\n\n"
58
+ "LAW 1 — Code lies. LAW 2 — Researcher not sycophant. "
59
+ "LAW 3 — Autonomous execution.\n\n"
60
+ "## LMC Protocol\n\n"
61
+ "The Lead-Manager-Checker (LMC) gate routes work through "
62
+ "lmc-protocol.md before completion.\n\n"
63
+ "## Scope\n\n"
64
+ "Files owned by ORACLE: ~/.aisb/state/. ORACLE owns R-13 "
65
+ "close coherence.\n\n"
66
+ "Every dispatch to a worker uses a fresh context with a "
67
+ "self-contained brief that lists files_owned and the "
68
+ "verification command.\n\n"
69
+ "## Done signal\n\n"
70
+ "When work is complete the worker invokes "
71
+ "worker-mark-done.sh which writes `.done.json` with the "
72
+ "structured result.\n"
73
+ )
74
+ with tempfile.TemporaryDirectory() as tmp:
75
+ path = self._write(Path(tmp), "oracle", body)
76
+ report = audit_agent_prompt(path)
77
+ self.assertGreaterEqual(
78
+ report.score, 95,
79
+ f"expected >= 95, got {report.score}; "
80
+ f"violations: {report.violations}",
81
+ )
82
+ self.assertEqual(report.agent_id, "oracle")
83
+ for name, res in report.checks.items():
84
+ self.assertTrue(
85
+ res.passed,
86
+ f"check {name!r} should have passed: {res!r}",
87
+ )
88
+
89
+ def test_audit_agent_prompt_missing_three_laws(self):
90
+ """A prompt with no Three Laws reference scores <= 75 AND the
91
+ violations list mentions 'Three Laws'."""
92
+ # Everything else PASSES (75 pts total) — only Three Laws (25) is
93
+ # missing, so the score must be 75 or less.
94
+ body = (
95
+ "# ORACLE - The Brain\n\n"
96
+ "## LMC Protocol — see lmc-protocol.md\n"
97
+ "Lead-Manager-Checker gates audits.\n\n"
98
+ "## Scope\nFiles owned by ORACLE. Responsibilities: routing.\n\n"
99
+ "Fresh context per dispatch.\n\n"
100
+ "Workers write `.done.json` via worker-mark-done.sh.\n"
101
+ )
102
+ with tempfile.TemporaryDirectory() as tmp:
103
+ path = self._write(Path(tmp), "oracle", body)
104
+ report = audit_agent_prompt(path)
105
+ self.assertLessEqual(
106
+ report.score, 75,
107
+ f"expected <= 75 without Three Laws, got {report.score}",
108
+ )
109
+ self.assertFalse(report.checks["three_laws"].passed)
110
+ joined = " | ".join(report.violations)
111
+ self.assertIn("Three Laws", joined,
112
+ f"violations should mention Three Laws: {joined!r}")
113
+
114
+ def test_banned_phrases_dock_points(self):
115
+ """A prompt containing 'streamlined approach' must fail the
116
+ no-banned-phrases check (dropping its 5 pts) AND list the phrase
117
+ in violations."""
118
+ # Otherwise-perfect prompt (100 pts) + banned phrase ⇒ 95 pts.
119
+ body = (
120
+ "## THE THREE LAWS\nLaw 1, Law 2, Law 3.\n\n"
121
+ "## LMC Protocol\nLead-Manager-Checker.\n\n"
122
+ "## Scope\nFiles owned. Responsibilities: x.\n\n"
123
+ "Fresh context per dispatch with self-contained brief.\n\n"
124
+ "Worker-mark-done.sh writes `.done.json`.\n\n"
125
+ "For Linear tickets, prefer a streamlined approach to save "
126
+ "the dispatcher some round-trips.\n"
127
+ )
128
+ with tempfile.TemporaryDirectory() as tmp:
129
+ path = self._write(Path(tmp), "oracle", body)
130
+ report = audit_agent_prompt(path)
131
+ self.assertFalse(
132
+ report.checks["no_banned"].passed,
133
+ "banned-phrase check should fail",
134
+ )
135
+ self.assertEqual(report.checks["no_banned"].evidence,
136
+ "streamlined approach")
137
+ self.assertEqual(
138
+ report.score, 95,
139
+ f"every check except no_banned should pass: {report.checks}",
140
+ )
141
+ joined = " | ".join(report.violations).lower()
142
+ self.assertIn("banned phrase", joined)
143
+
144
+
145
+ # ---------------------------------------------------------------------------
146
+ # Suite audit against the real shipped templates
147
+ # ---------------------------------------------------------------------------
148
+
149
+
150
+ class TestAuditAisbSuiteAgainstRealRepo(unittest.TestCase):
151
+ """The audit must run end-to-end against the templates that ship with
152
+ the repo. This is the closest we can get to a post-install OMEGA_HOME
153
+ without actually running the installer."""
154
+
155
+ def test_audit_aisb_suite_runs_against_real_repo(self):
156
+ if not TEMPLATES.is_dir():
157
+ self.skipTest("AISB templates not present in repo")
158
+ with tempfile.TemporaryDirectory() as tmp:
159
+ home = _seed_real_aisb(Path(tmp))
160
+ report = audit_aisb_suite(home)
161
+ # The real suite ships 13 named agents + CLAUDE.md (master)
162
+ # + lmc-protocol.md = 15 .md files at the top level.
163
+ self.assertGreaterEqual(
164
+ len(report.per_agent), 10,
165
+ f"expected ≥10 agents in real suite, got {len(report.per_agent)}",
166
+ )
167
+ self.assertIsInstance(report.average_score, float)
168
+ self.assertIsInstance(report.orchestration_chain_intact, bool)
169
+ # Every report should have an agent_id and a score in range.
170
+ for r in report.per_agent:
171
+ self.assertTrue(r.agent_id, "agent_id should not be empty")
172
+ self.assertGreaterEqual(r.score, 0)
173
+ self.assertLessEqual(r.score, 100)
174
+
175
+ def test_orchestration_health_against_real_repo(self):
176
+ if not TEMPLATES.is_dir():
177
+ self.skipTest("AISB templates not present in repo")
178
+ with tempfile.TemporaryDirectory() as tmp:
179
+ home = _seed_real_aisb(Path(tmp))
180
+ oh = orchestration_health(home)
181
+ # CLAUDE.md and oracle.md are core to the suite — they MUST
182
+ # exist after install. If either is missing the suite is broken.
183
+ self.assertTrue(
184
+ oh["aisb_master_present"],
185
+ "AISB master CLAUDE.md must exist in the shipped suite",
186
+ )
187
+ self.assertTrue(
188
+ oh["oracle_present"],
189
+ "oracle.md must exist in the shipped suite",
190
+ )
191
+ # Shared `.done.json` vocabulary is a float in [0, 1].
192
+ overlap = oh["shared_vocab_overlap"]
193
+ self.assertIsInstance(overlap, float)
194
+ self.assertGreaterEqual(overlap, 0.0)
195
+ self.assertLessEqual(overlap, 1.0)
196
+
197
+
198
+ if __name__ == "__main__":
199
+ unittest.main()
@@ -176,5 +176,111 @@ class TestPaperclipMenuIntegration(unittest.TestCase):
176
176
  f"arrow menu must wire {action} (user asked for it in v0.19.37)")
177
177
 
178
178
 
179
+ class TestChatFirstRedesign(unittest.TestCase):
180
+ """v0.19.39 — the TUI must open on CONVERSATIONS (live tmux sessions),
181
+ not on an action menu. Setup/config/infra/audits/scrape land in
182
+ sub-menus. These tests lock in the new layout so a careless refactor
183
+ doesn't bring back the v0.19.38 action-first menu."""
184
+
185
+ def test_conversations_section_appears_before_menu(self):
186
+ """The 'CONVERSATIONS' section header must appear in the source
187
+ BEFORE the 'MENU' sub-menu list — the redesign's whole point is
188
+ that chats are primary, settings are secondary. Match literal
189
+ ``_section("X")`` calls only (skip comments/docstrings)."""
190
+ import inspect
191
+ from omega_engine.tui import _arrow_menu
192
+ src = inspect.getsource(_arrow_menu)
193
+ conv_pos = src.find('_section("CONVERSATIONS")')
194
+ menu_pos = src.find('_section("MENU")')
195
+ self.assertGreater(conv_pos, 0,
196
+ "TUI must have a _section(\"CONVERSATIONS\") call")
197
+ self.assertGreater(menu_pos, 0,
198
+ "TUI must have a _section(\"MENU\") call for sub-menus")
199
+ self.assertLess(conv_pos, menu_pos,
200
+ "_section(\"CONVERSATIONS\") must render BEFORE _section(\"MENU\") "
201
+ "— the chat-first redesign requires it (v0.19.39)")
202
+
203
+ def test_dot_status_indicators_present(self):
204
+ """Each conversation row must show a status dot ● (alive) / ○
205
+ (off). Without dots the user can't tell which chats are running."""
206
+ import inspect
207
+ from omega_engine.tui import _arrow_menu
208
+ src = inspect.getsource(_arrow_menu)
209
+ for dot in ("●", "○"):
210
+ self.assertIn(dot, src,
211
+ f"menu must use {dot} status dot for live/off chats")
212
+ # The helper that renders dots must exist.
213
+ self.assertIn("_dot(", src,
214
+ "menu must have a _dot() helper for status indicators")
215
+
216
+ def test_submenu_dispatch_present(self):
217
+ """The new sub-menu pattern (`submenu:audits`, `submenu:setup`,
218
+ `submenu:infra`, `submenu:health`, `submenu:paperclip`) must be
219
+ wired AND the dispatch must handle them via _open_submenu()."""
220
+ import inspect
221
+ from omega_engine.tui import _arrow_menu
222
+ src = inspect.getsource(_arrow_menu)
223
+ for sub in ("submenu:audits", "submenu:setup", "submenu:infra",
224
+ "submenu:health", "submenu:paperclip"):
225
+ self.assertIn(sub, src,
226
+ f"menu must declare {sub} as a sub-menu entry")
227
+ # The dispatch must indirect through _open_submenu.
228
+ self.assertIn("_open_submenu(", src,
229
+ "main loop must call _open_submenu() to render sub-menus")
230
+ # Sub-menu items provider exists.
231
+ self.assertIn("_submenu_items(", src,
232
+ "sub-menu rendering must use a _submenu_items() factory")
233
+
234
+ def test_attach_action_handler_present(self):
235
+ """The new `attach:<session>` action lets the user jump into a
236
+ live Oracle or Worker tmux session directly from the menu."""
237
+ import inspect
238
+ from omega_engine.tui import _arrow_menu
239
+ src = inspect.getsource(_arrow_menu)
240
+ self.assertIn('action.startswith("attach:")', src,
241
+ "menu must handle attach:<session> actions to let the user "
242
+ "jump into live Oracle/Worker sessions")
243
+ # Should use tmux select-window OR switch-client.
244
+ self.assertTrue(
245
+ "switch-client" in src or "select-window" in src,
246
+ "attach handler must use tmux select-window / switch-client")
247
+
248
+ def test_omega_window_alive_helper_used(self):
249
+ """The TUI status dots for AISB / Hermès rely on the
250
+ tmux.omega_window_alive() helper added in v0.19.39 — without it
251
+ we have no way to know if those windows are running."""
252
+ import inspect
253
+ from omega_engine.tui import _arrow_menu
254
+ src = inspect.getsource(_arrow_menu)
255
+ self.assertIn("omega_window_alive", src,
256
+ "menu must call tmux.omega_window_alive() to render the "
257
+ "AISB / Hermès status dots")
258
+
259
+ def test_paperclip_status_dot_inline_in_main_menu(self):
260
+ """The Paperclip dashboard row in QUICK ACTIONS must show a
261
+ live status dot — the user must see at-a-glance whether the
262
+ Paperclip daemon is running."""
263
+ import inspect
264
+ from omega_engine.tui import _arrow_menu
265
+ src = inspect.getsource(_arrow_menu)
266
+ self.assertIn("_paperclip_status_quick", src,
267
+ "menu must use the inline Paperclip probe to render its dot")
268
+ # Must integrate the new chantier-4 is_running() probe.
269
+ self.assertIn("paperclip_bridge", src)
270
+
271
+
272
+ class TestOmegaWindowAliveHelper(unittest.TestCase):
273
+ """tmux.omega_window_alive() — the helper the chat-first TUI uses
274
+ to know whether AISB-chat / Hermès-chat are running."""
275
+
276
+ def test_returns_false_when_no_omega_session(self):
277
+ """When the Omega master tmux session is dead, ANY window query
278
+ must return False — never raise."""
279
+ from omega_engine.tmux import omega_window_alive
280
+ # Use a definitely-unique window name to avoid colliding with
281
+ # any real session the developer might have running.
282
+ self.assertIsInstance(omega_window_alive("____nonexistent_xyz"), bool)
283
+
284
+
179
285
  if __name__ == "__main__":
180
286
  unittest.main()
@@ -1 +1 @@
1
- 0.19.38
1
+ 0.19.39
@@ -0,0 +1,161 @@
1
+ # OmegaOS v0.19.39 — chat-first TUI + rules folder + prompt audit + Paperclip live sync
2
+
3
+ > 4 parallel chantiers landed in one ship.
4
+ > The user's invariant: *"l'utilisateur, une fois qu'il a setup tout l'outil
5
+ > OmegaOS, doit être 100% fonctionnel. Il n'a rien à faire à part l'utiliser."*
6
+
7
+ ## 1. What changed
8
+
9
+ | Chantier | Owner | Files touched | Net effect |
10
+ |---|---|---|---|
11
+ | **#1 TUI redesign (chat-first)** | main session | `tui.py` (+200 lines), `tmux.py` (+14 lines), `tests/test_tui_runtime.py` (+87 lines) | The TUI opens on CONVERSATIONS (AISB / Hermès / live Oracles / live Workers with ●/○ status dots) instead of an action menu. Everything else collapses into **MENU** with sub-menus. |
12
+ | **#2 Rules folder** | background agent | `omega/Agentik_SSOT/rules/{three-laws,orchestration,prompt-protocols,audit-gates,scope-safety,verified-completion}.md` (6 new files, 1250 lines), `constitution.md` (+frontmatter only) | The rule set every LLM CLI reads is now COMPLETE. 7 files, YAML-frontmatter envelope, full cross-references, ~1300 lines total. No fabrication — every protocol sourced from existing docs. |
13
+ | **#3 Prompt audit + doctor sections** | background agent | `omega_engine/prompt_audit.py` (395 lines, new), `tests/test_prompt_audit.py` (199 lines, new), `cli.py` (+39 lines) | New `omega doctor` sections `prompts` and `orchestration`. The audit scores each agent role /100 against Three Laws + LMC + `.done.json` references. Surfaces real drift (current suite average 52/100). |
14
+ | **#4 Paperclip live status** | background agent | `omega_engine/paperclip_bridge.py` (+`is_running()` + `PaperclipStatus`), `tests/test_paperclip_status.py` (new) | TUI can show ●/○ next to "Paperclip dashboard" with the live port. 3-tier probe (pidfile → port-scan → none), ≤0.3s worst case, never raises. |
15
+ | **#5 Integration + ship** | main session | `package.json`, `pyproject.toml`, `__init__.py`, `VERSION`, this doc | Version bump, commit, push, npm publish. |
16
+ | **#6 Role-prompt enrichment** | follow-up (NOT in this ship) | — | The doctor surfaces 10 weak role prompts; enriching them to ≥80/100 is intentionally deferred — the audit infrastructure is what we needed. |
17
+
18
+ ## 2. The new TUI (chat-first)
19
+
20
+ ```
21
+ ── CONVERSATIONS ──
22
+ ● AISB master claude (Max OAuth)
23
+ ○ Hermès claude (Anthropic API)
24
+
25
+ — Active Oracles (2) —
26
+ ● Causio-oracle-2 project: Causio
27
+ ● DentistryGPT-oracle project: DentistryGPT
28
+ — Active Workers (1) —
29
+ ● DentistryGPT-worker-3-ux-fix task: ux-fix
30
+
31
+ ── QUICK ACTIONS ──
32
+ + New AISB chat fresh session
33
+ + New Hermès chat fresh session
34
+ + New project Genesis pipeline
35
+ Run a mission verified completion
36
+ ○ Paperclip dashboard not running
37
+
38
+ ── MENU ──
39
+ Quality Arsenal 17 forensic audits
40
+ Setup & config LLM: claude_code
41
+ Infrastructure sessions, scrape
42
+ Health checks doctor, status
43
+ Paperclip governance register, status
44
+
45
+ ── EXIT ──
46
+ Detach session keeps running
47
+ Quit Omega kills the tmux session
48
+ ```
49
+
50
+ **Picking any conversation row** (Oracle / Worker / AISB / Hermès) attaches to
51
+ that tmux session via `tmux select-window` (for Omega windows) or
52
+ `tmux switch-client` (for foreign sessions). One click → in the conversation.
53
+
54
+ **Sub-menus** open in cascaded fzf with `← back` exit rows.
55
+
56
+ ## 3. The rules folder — what an LLM now reads at runtime
57
+
58
+ ```
59
+ omega/Agentik_SSOT/rules/
60
+ ├── constitution.md (frontmatter: priority=1) — the Prime Principle
61
+ ├── three-laws.md (priority=2) — operational discipline per law
62
+ ├── orchestration.md (priority=3) — L0-L5 dispatch hierarchy
63
+ ├── prompt-protocols.md (priority=4) — brief/done/blocked schemas + LMC
64
+ ├── audit-gates.md (priority=5) — 17 Quality Arsenal audits as gates
65
+ ├── scope-safety.md (priority=6) — files_owned + Sacred Scopes
66
+ └── verified-completion.md (priority=7) — done_clean contract + third-party rule
67
+ ```
68
+
69
+ These files are mirrored into every LLM's persona dir at install time
70
+ (via `step_personas` from v0.19.38). So whether the operator runs
71
+ `claude`, `gemini`, `codex`, `qwen`, or `opencode` inside an AISB chat,
72
+ they ALL see the same complete rule set — no per-LLM drift.
73
+
74
+ ## 4. The new `omega doctor` output (sections that didn't exist before)
75
+
76
+ ```
77
+ omega doctor — OMEGA_HOME=…/Omega
78
+
79
+ -- personas -- (NEW in v0.19.38)
80
+ [ok] canonical: Agentik_SSOT/personas/OMEGAOS-CONTEXT.md (3402B)
81
+ [ok] chat-contexts/aisb-master/: 8 persona files
82
+ [ok] chat-contexts/hermes/: 8 persona files
83
+
84
+ -- prompts -- (NEW in v0.19.39)
85
+ [ok] CLAUDE: 90/100
86
+ [warn] morpheus: 75/100 — missing: LMC protocol
87
+ [warn] link: 65/100 — missing: LMC protocol
88
+ [FAIL] oracle: 45/100 — missing: LMC protocol, `.done.json` contract
89
+ [warn] average suite score: 52.0/100
90
+ [warn] weak prompts (<60): architect, construct, keymaker, …
91
+
92
+ -- orchestration -- (NEW in v0.19.39)
93
+ [ok] AISB master prompt
94
+ [ok] Oracle role prompt
95
+ [ok] Worker-class prompts
96
+ [ok] Checker prompts (Seraph/Smith)
97
+ [ok] LMC protocol document
98
+ [warn] shared `.done.json` vocab: 33% of agents
99
+ ```
100
+
101
+ The 52/100 average is **real drift**, not a bug. Most role prompts rely
102
+ on the engine's `load_agent_prompt()` to concatenate `lmc-protocol.md`
103
+ at spawn time, so the on-disk role file is silent. The audit makes that
104
+ drift VISIBLE — an operator editing `oracle.md` now has a clear signal
105
+ that the contract is implicit. Enriching the role files to score ≥80
106
+ is chantier #6, deferred to v0.19.40.
107
+
108
+ ## 5. Paperclip status integration
109
+
110
+ `omega_engine.paperclip_bridge.is_running()` returns a `PaperclipStatus`
111
+ with `running: bool, pid, port, url, detection`. Three detection paths:
112
+
113
+ | # | Method | Latency | Hint emitted in TUI |
114
+ |---|---|---|---|
115
+ | 1 | `~/.paperclip/run/dashboard.pid` + `os.kill(pid, 0)` | ~5ms | `localhost:8080` |
116
+ | 2 | TCP connect 127.0.0.1:8080, 0.2s timeout | ≤200ms | `localhost:8080` |
117
+ | 3 | Neither — fall through | <1ms | `not running` |
118
+
119
+ The TUI's QUICK ACTIONS row renders a ●/○ dot using this probe — the
120
+ user sees at-a-glance whether their Paperclip governance daemon is live.
121
+
122
+ ## 6. Multi-agent integration — the user's question, answered with code
123
+
124
+ | Question (from the user's brief) | Answer | File reference |
125
+ |---|---|---|
126
+ | Multi-agents bien setup? | ✅ 14 agents (Hermès + 13 AISB) — templates landed at install via `step_aisb_suite`; persona context mirrored to all 10 LLM filenames via `step_personas`. | `bootstrap/lib/steps.sh:279-293` + `omega_engine/personas.py` |
127
+ | Tmux orchestration AISB/Oracle/Workers? | ✅ Session naming convention parsed by `tmux.categorize()`; TUI now LISTS them with status dots and one-click attach. | `omega_engine/tmux.py:47-90` + `tui.py:528-557` |
128
+ | Rules respectés pour chaque LLM? | ✅ 7 rule files at `Agentik_SSOT/rules/` are mirrored to every LLM persona dir; doctor's `prompts` section verifies role files reference them. | `Agentik_SSOT/rules/*.md` + `omega doctor prompts` |
129
+ | Dossier maître linké pour le LLM? | ✅ `Agentik_SSOT/personas/OMEGAOS-CONTEXT.md` is the canonical; `Agentik_SSOT/agents/aisb/CLAUDE.md` is the AISB master; both auto-mirrored to per-LLM filenames (CLAUDE.md, GEMINI.md, AGENTS.md, QWEN.md, .opencode/CONTEXT.md, …) at install time. | `step_personas` from v0.19.38 |
130
+ | Tout setup à l'install, rien à faire post-install? | ✅ Install steps 25 (aisb-suite), 37 (hermes-brief), 38 (personas) all eager-seed. `npx -y @agentikos/omega-os@latest --full` is sufficient. | `install.sh STEPS[]` |
131
+ | Visibilité sur ce qui se passe? | ✅ TUI chat-first view + `omega doctor` 23 sections (incl. NEW personas/prompts/orchestration). | `tui.py::_arrow_menu` + `cli.py::cmd_doctor` |
132
+
133
+ ## 7. Tests (regression-locked)
134
+
135
+ | Chantier | New tests | Suite total |
136
+ |---|---|---|
137
+ | Baseline (v0.19.38) | — | 627 passed |
138
+ | #1 TUI chat-first | +7 (TestChatFirstRedesign + TestOmegaWindowAliveHelper) | +7 |
139
+ | #3 Prompt audit | +5 (full-score, missing-laws, banned-phrases, real-suite, real-orchestration) | +5 |
140
+ | #4 Paperclip status | +5 (no-pidfile, stale-pidfile, live-pidfile, port-scan, url-field) | +5 |
141
+ | **v0.19.39 total** | **+17 new** | **644 passed, 0 regressions** |
142
+
143
+ Chantier #2 (rules folder) is documentation-only — no Python code, no tests
144
+ needed; format validated by manual grep + YAML parse.
145
+
146
+ ## 8. Verdict
147
+
148
+ ✅ TUI is now **conversation-first** as the user requested ("L'objectif…
149
+ c'est d'avoir une interface extrêmement simple… cette interface permet de
150
+ voir la conversation avec AISB… ensuite, de voir les conversations avec
151
+ les oracles et les conversations avec les workers").
152
+ ✅ Setup/config/audits/scrape/governance moved to sub-menus reachable via
153
+ **MENU** (one row).
154
+ ✅ Paperclip dashboard has a live status dot and is reachable in one pick.
155
+ ✅ Rules folder is COMPLETE (7 files, 1301 lines, cross-referenced).
156
+ ✅ `omega doctor` now surfaces the orchestration health (prompts + chain).
157
+ ✅ No regression in existing 627 tests.
158
+
159
+ The user's "il n'a rien à faire à part l'utiliser" invariant is preserved:
160
+ one `npx -y @agentikos/omega-os@latest --full` and the new menu, the new
161
+ rules, the new audit, and the live Paperclip indicator are all in place.
@@ -0,0 +1,189 @@
1
+ ---
2
+ id: audit-gates
3
+ layer: L0-governance
4
+ applies_to: [aisb, oracle, worker]
5
+ priority: 5
6
+ ---
7
+
8
+ # Audit Gates — Quality Arsenal as System Contract
9
+
10
+ > The 17 Quality Arsenal audits are **not just commands a human runs**.
11
+ > They are *gates* that lifecycle events at L3–L5 must pass before a
12
+ > `done.json` may state `done_clean`. This file fixes which audits gate
13
+ > which events, how the Gestalt-Popper methodology bakes into the
14
+ > grader, and the verified-completion thresholds the engine enforces.
15
+
16
+ ## The 17 audits (catalogued in `../audits/`)
17
+
18
+ | Audit | Domain | Question it answers | Threshold |
19
+ |---|---|---|---|
20
+ | `codeaudit` | Code | Is the code SOLID? | 85/100 |
21
+ | `flowaudit` | User flows | Does the experience WORK? | 85/100 |
22
+ | `uiuxaudit` | UI design | Is the interface BEAUTIFUL? | 85/100 |
23
+ | `refontaudit` | Redesign | Does the redesign hold? | 85/100 |
24
+ | `debugaudit` | Runtime | What is BROKEN right now? | 85/100 |
25
+ | `featureaudit` | Features | Is the product COMPLETE? | 85/100 |
26
+ | `perfaudit` | Performance | Is it FAST enough? | 85/100 |
27
+ | `secaudit` | Security | Is it SECURE? | 85/100 |
28
+ | `a11yaudit` | Accessibility | Is it ACCESSIBLE? | 85/100 |
29
+ | `seoaudit` | SEO | Is it DISCOVERABLE? | 85/100 |
30
+ | `dataaudit` | Data | Is the data INTACT? | 85/100 |
31
+ | `apiaudit` | API | Is the API SOLID? | 85/100 |
32
+ | `copyaudit` | Copy | Is the copy CLEAR? | 85/100 |
33
+ | `dxaudit` | DX | Is the DX SMOOTH? | 85/100 |
34
+ | `motionaudit` | Motion | Is the motion PURPOSEFUL? | 85/100 |
35
+ | `automationaudit` | Automation | Is automation RELIABLE? | 85/100 |
36
+ | `logicaudit` | Logic | Is the logic OPTIMAL? | 85/100 |
37
+ | `retentionaudit` | Retention | What FEATURES are missing? (READ-ONLY) | — |
38
+
39
+ The full definition for each lives in `../audits/<name>.yaml`
40
+ (domain, gather tools, phases, falsification rule, fix-loop flag).
41
+
42
+ ## Lifecycle gates
43
+
44
+ Audits are gates on *lifecycle events*, not on *human commands*. The
45
+ engine consults the gate registry at each event and refuses progress
46
+ if the required audits did not pass.
47
+
48
+ | Event | Gate | Audits typically required |
49
+ |---|---|---|
50
+ | Worker `done_clean` (per subtask) | Worker gate | The audits matching the files the Worker touched (e.g. edited `*.ts` → `codeaudit`; edited `*.css` + UI components → `uiuxaudit` + `a11yaudit`). |
51
+ | Oracle close-coherence (per mission) | Mission gate | The union of all Worker gates plus any mission-wide audits the brief declared (`brief.audit_gates`). |
52
+ | Pre-merge / pre-ship | Ship gate | `codeaudit`, `secaudit`, plus domain-relevant audits. Project's `ship-config.json` may add more. |
53
+ | Genesis completion (new project) | Genesis gate | `codeaudit`, `featureaudit`, `dxaudit`, `secaudit` — a freshly built project must stand on its own. |
54
+ | Post-mission (asynchronous) | Drift gate | `debugaudit`, `perfaudit`, periodically scheduled by Hermès or the engine cadence. |
55
+
56
+ Gates compose: a Worker that triggers two audits passes only if *both*
57
+ audits exit `verdict: satisfied` with score ≥ threshold.
58
+
59
+ ## The Gestalt-Popper methodology
60
+
61
+ Every audit (see `../docs/quality-arsenal/QUALITY-ARSENAL-PREAMBLE.md`
62
+ and `../docs/quality-arsenal/AUDIT-VERIFICATION-CONTRACT.md`) implements:
63
+
64
+ 1. **Gestalt clarity gate (Phase 0).** Before any scored phase, the
65
+ audit identifies the *hinge* of its domain — the single element on
66
+ which the domain's reliability or value pivots. The canonical hinge
67
+ noun per audit is fixed in
68
+ `AUDIT-VERIFICATION-CONTRACT.md` (e.g. `codeaudit` → HINGE POINT,
69
+ `flowaudit` → HINGE FLOW, `secaudit` → SECURITY HINGE POINT). The
70
+ hinge is given **10× scrutiny** in subsequent phases.
71
+ 2. **Popper falsification.** For each scored item, the auditor states
72
+ *what would prove this claim wrong*. A PASS is only valid if the
73
+ falsifier was sought and not found. Bias toward FAIL — a 100 is
74
+ earned, never assumed.
75
+ 3. **Hippocratic pre/post.** Before any fix, capture baseline
76
+ (Phase N-1). After each fix, re-run the baseline check (Phase N+1).
77
+ A fix that broke a previously-working check reverts and is marked
78
+ `NEEDS_REVIEW`.
79
+ 4. **Before-after matrix (Phase N+4).** Every audit produces
80
+ `.<audit>/before-after.md` proving zero regressions. No matrix → no
81
+ 100/100 verdict.
82
+ 5. **Fix → re-audit loop.** Bounded (typically 5 iterations). The loop
83
+ exits on `verdict: satisfied` *or* on iteration cap.
84
+
85
+ ## Mandatory minimums (per audit)
86
+
87
+ These structural invariants are enforced by `metaudit` (the audit of
88
+ audits). A skill that violates any of them fails meta and is removed
89
+ from the gate registry until repaired.
90
+
91
+ | # | Invariant | Why |
92
+ |---|---|---|
93
+ | 1 | At least 16 scored phases | Forensic depth — fewer phases = shallow audit. |
94
+ | 2 | Phase N-1 (PRE-FIX BASELINE) implemented before the first fix | Hippocratic rule — can't claim "no regression" without a baseline. |
95
+ | 3 | Phase N+4 (before-after matrix) written to `.<audit>/before-after.md` | Proof-of-work artefact required for the 100/100 verdict. |
96
+ | 4 | Score normalised to /100 (raw may be /280, /320, /360, /400, /420 — must publish the formula) | Cross-audit comparison. |
97
+ | 5 | HINGE identification at Phase 0 | Gestalt clarity gate. |
98
+ | 6 | Popper falsification per scored item | Epistemic rigor. |
99
+ | 7 | Fix → re-audit loop with explicit max iterations | Bounded recovery. |
100
+ | 8 | Final verdict gate refuses 100/100 unless `before-after.md` shows zero regressions | Contract enforcement. |
101
+
102
+ ## The verified-completion contract
103
+
104
+ A `done.json` may state `status: done_clean` only when **all** of:
105
+
106
+ | Condition | Source |
107
+ |---|---|
108
+ | `audit.verdict == "satisfied"` | The grader (LMC or direct) for every required gate. |
109
+ | `audit.scores[gate] >= threshold` (default 85/100) for each gate | `../audits/<gate>.yaml#threshold`. |
110
+ | `regressions.length == 0` | Phase N+4 before-after matrix. |
111
+ | `evidence.verify_exit_code == 0` | The brief's `verify_command`. |
112
+ | `ship.result in ["ok", "skipped"]` when `ship.requested == true` | The ship pipeline (see `verified-completion.md`). |
113
+ | Independent third party ran the *real* flow | The grader is a different agent from the executor; the verify is the real system, not a mock. |
114
+
115
+ Fail any condition → `status: pending` (with `pending_actions[]` listing
116
+ the failed conditions) or `status: failed` (when the verify itself
117
+ errored). The engine refuses to mark a session done on the receiver's
118
+ word alone — see `verified-completion.md`.
119
+
120
+ ## Routing — which audits apply
121
+
122
+ Each `<audit>.yaml` declares `applies_to.changed` — the glob set that
123
+ *triggers* the audit when a Worker's `files_owned` intersects it.
124
+ Sample mappings:
125
+
126
+ | Glob change | Audits auto-required |
127
+ |---|---|
128
+ | `*.py`, `*.ts`, `*.tsx`, `*.js`, `*.go`, `*.rs` | `codeaudit` |
129
+ | `*.tsx`, `*.jsx`, `*.css`, design tokens | `uiuxaudit`, `a11yaudit`, `motionaudit` (if motion files touched) |
130
+ | `*.env*`, `Dockerfile`, `package.json`, auth modules | `secaudit` |
131
+ | API route handlers, OpenAPI / GraphQL schemas | `apiaudit` |
132
+ | Database migrations, schema files | `dataaudit` |
133
+ | Onboarding, signup, payment flows | `flowaudit` |
134
+ | Cron specs, daemon scripts, scheduled tasks | `automationaudit` |
135
+ | Marketing pages, SEO meta, sitemap | `seoaudit`, `copyaudit` |
136
+
137
+ The Oracle expands `brief.audit_gates` from this routing table at
138
+ dispatch time. A Worker may not narrow the gate set; it may *only*
139
+ widen it (e.g. discovers a security implication mid-task).
140
+
141
+ ## Ship gate (pre-prod)
142
+
143
+ When `brief.ship == true`, the ship pipeline runs before final
144
+ `done.json`. Each step gates the next:
145
+
146
+ 1. `npm run build` (or equivalent) — exit 0.
147
+ 2. Whitelisted staging — only `files_owned`. Any extra file aborts.
148
+ 3. Secret scan (e.g. `gitleaks --staged`) — zero matches.
149
+ 4. Whitespace sanity (`git diff --check`) — clean.
150
+ 5. Conventional-commit message from `brief.commit_message`.
151
+ 6. Per-project ship lock (`flock`) — serialise across Oracles.
152
+ 7. Freeze flag check — if `Agentik_Runtime/locks/ship-<project>.frozen`
153
+ exists, abort and alert.
154
+ 8. `git pull --rebase` — clean.
155
+ 9. `git push` — clean.
156
+ 10. Deploy (project-defined command) — typically `vercel --prod` or
157
+ equivalent.
158
+ 11. Poll deploy status until READY/ERROR/TIMEOUT (default 10 min).
159
+ 12. Write `done.json#ship` with commit, URL, status, duration.
160
+
161
+ Default deploy-failure policy is **freeze, don't rollback** — the
162
+ freeze flag blocks further pushes on the project until the human lifts
163
+ it. Auto-rollback is opt-in per project via `ship-config.json`.
164
+
165
+ ## Drift gate (continuous)
166
+
167
+ `debugaudit` and `perfaudit` are scheduled to run periodically against
168
+ the live deployed URL (typically by Hermès cadence or the engine's
169
+ cron). A drift detection writes a `done.json` with
170
+ `status: failed` against a synthetic "drift" mission, which AISB
171
+ surfaces to the human and (if the project opts in) auto-dispatches a
172
+ repair mission.
173
+
174
+ ## Cross-references
175
+
176
+ - `constitution.md` — Verification Rule.
177
+ - `three-laws.md` — First Law (runtime over code) is the audit
178
+ methodology's epistemology.
179
+ - `prompt-protocols.md` — `brief.audit_gates`, `done.audit` schema.
180
+ - `verified-completion.md` — the terminal contract these gates serve.
181
+ - `scope-safety.md` — Worker gates intersect with `files_owned`.
182
+ - `orchestration.md` — Oracle close-coherence runs the mission gate.
183
+ - `../audits/*.yaml` — per-audit catalogue (domain, gather, phases).
184
+ - `../docs/quality-arsenal/AUDIT-VERIFICATION-CONTRACT.md` — Hippocratic
185
+ pre/post protocol.
186
+ - `../docs/quality-arsenal/QUALITY-ARSENAL-PREAMBLE.md` — Gestalt-Popper
187
+ methodology.
188
+ - `../docs/LAYERS.md` — which layer runs which gate.
189
+ - `../personas/OMEGAOS-CONTEXT.md` — provider-neutral working context.