{ "$schema": "https://json-schema.org/draft/2020-12/schema", "title": "Regex Patterns & Passing Engine", "version": "1.0.0", "patterns": { "work_order": { "name": "Work Order Parser", "pattern": "^\\[WO:(?P[a-f0-9-]+)\\]\\s+\\[from\\s+(?P[a-zA-Z0-9_-]+)\\]\\s+(?P[^—\\n]+?)\\s*—\\s*(?P<body>.+)$", "flags": ["MULTILINE", "DOTALL"], "description": "Matches canonical Work Order messages, extracting unique ID, sender, title, and body.", "named_groups": { "wo_id": "Unique work order identifier (hex or UUID)", "sender": "Originating agent or operator identity", "title": "Short title describing the task", "body": "Full body text and instructions" }, "test_samples": { "valid": [ "[WO:7fce46e0] [from super] Audit exec.muse-dev.online endpoints — Run full verification and check 200 codes.", "[WO:a1b2c3d4-e5f6-7890-abcd-ef1234567890] [from 646] Deploy patch — Apply fix to response-harvester." ], "invalid": [ "Just sending a regular message without tag", "[WO:] missing id [from super] title — body", "[WO:123] missing from tag title — body" ] }, "usage": "Used by dm.py, super dm, and self_main_loop.py for tracking work orders." }, "ack": { "name": "Acknowledgement Parser", "pattern": "^\\[ACK:(?P<ack_id>[a-f0-9-]+)\\](?:\\s+\\[from\\s+(?P<sender>[a-zA-Z0-9_-]+)\\])?", "flags": ["MULTILINE"], "description": "Matches work order acknowledgement tags, capturing referenced ID and optional sender.", "named_groups": { "ack_id": "Referenced work order ID being acknowledged", "sender": "Optional sender acknowledging the message" }, "test_samples": { "valid": [ "[ACK:7fce46e0] [from 646]", "[ACK:a1b2c3d4]" ], "invalid": [ "ACK: 7fce46e0", "[ACK:]", "Acknowledged without brackets" ] }, "usage": "Used by response-harvester.py and followup-sweeper.py to transition loops to acknowledged." }, "verb": { "name": "Standard Agent Verb Marker", "pattern": "\\[(?P<verb>ACK|CLAIM|RESULT|DECLINE|NO-ACTION)\\s+(?P<job_id>[A-Za-z0-9_/-]+)\\]", "flags": [], "description": "Matches all standard conversational contract verbs referencing a job ID.", "named_groups": { "verb": "One of ACK, CLAIM, RESULT, DECLINE, NO-ACTION", "job_id": "Target task or job identifier" }, "test_samples": { "valid": [ "[ACK 7fce46e0]", "[CLAIM job-123]", "[RESULT swarm-4a/2]", "[DECLINE audit-01]", "[NO-ACTION check-99]" ], "invalid": [ "[DONE 7fce46e0]", "[RESULT]", "RESULT 7fce46e0 without brackets" ] }, "usage": "Primary regex used in response-harvester.py (VERB_RE) for loop state resolution." }, "result": { "name": "Task Result & Outcome Parser", "pattern": "\\[RESULT\\s+(?P<job_id>[A-Za-z0-9_/-]+)\\]\\s*(?P<status>OK|FAIL|DECLINE|SUCCESS|ERROR)?\\s*(?P<summary>.*?)(?=\\[RESULT\\s|\\Z)", "flags": ["DOTALL"], "description": "Extracts job ID, optional status flag, and trailing summary for task outcomes.", "named_groups": { "job_id": "Target job or swarm slot ID", "status": "Optional explicit status token (OK, FAIL, etc.)", "summary": "Outcome description and evidence payload" }, "test_samples": { "valid": [ "[RESULT 7fce46e0] OK Verified 14 endpoints successfully.", "[RESULT test-job] FAIL Connection timed out on port 22", "[RESULT swarm-1/0] Completed slot tasks." ], "invalid": [ "Result of job 123 is OK", "[RESULT] missing job id" ] }, "usage": "Used in response-harvester.py (RESULT_RE) to harvest results into job-log.jsonl." }, "tool_call": { "name": "In-Band Tool Execution Call", "pattern": "\\[(?P<engine>TOOL|EXEC)\\s+(?P<op>[a-zA-Z0-9_.-]+)\\s+(?P<args>\\{.*?\\})\\]", "flags": ["DOTALL"], "description": "Matches synthesized inline tool execution directives with JSON arguments.", "named_groups": { "engine": "Either TOOL or EXEC", "op": "Target operation name (e.g. followup.create, swarm.spawn)", "args": "Valid JSON string of argument parameters" }, "test_samples": { "valid": [ "[TOOL followup.create {\"in_m\": 5, \"prompt\": \"check\"}]", "[EXEC health.check {\"verbose\": true}]" ], "invalid": [ "[TOOL followup.create without args]", "[TOOL invalid args not json]" ] }, "usage": "Parsed by response-harvester.py and exec-constrained.py for automated in-line actions." }, "job_tag": { "name": "Job Tracking Tag", "pattern": "\\[JOB\\s+(?P<job_id>[A-Za-z0-9_/-]+)\\]", "flags": [], "description": "Matches job tag markers embedded in digests, tasks, or swarm slots.", "named_groups": { "job_id": "Unique job identifier" }, "test_samples": { "valid": [ "[JOB ml-646-20261005-191500]", "[JOB swarm-4b/1]" ], "invalid": [ "JOB ml-646 without brackets", "[JOB]" ] }, "usage": "Used by self_main_loop.py and job-dispatch.py for tracking." }, "nudge": { "name": "Loop Followup Nudge Parser", "pattern": "\\[NUDGE\\s+(?P<loop_id>[a-f0-9-]+)\\]\\s*(?:\\[nudge\\s+(?P<count>\\d+)/(?P<max_count>\\d+)\\])?\\s*(?:Deadline\\s+(?P<deadline>[^:]+):)?\\s*(?P<prompt>.*)", "flags": ["MULTILINE"], "description": "Matches automated followup nudges, extracting loop ID, nudge counters, and deadlines.", "named_groups": { "loop_id": "Target loop identifier", "count": "Current nudge sequence number", "max_count": "Maximum allowed nudges before escalation", "deadline": "Deadline timestamp string", "prompt": "Nudge message instructions" }, "test_samples": { "valid": [ "[NUDGE 7fce46e0] [nudge 1/3] Deadline 19:45 UTC: Please confirm status of exec audit.", "[NUDGE a1b2c3d4] Please review pending pull request." ], "invalid": [ "Nudge for 7fce46e0", "[NUDGE]" ] }, "usage": "Used by followup-sweeper.py for SLA enforcement." }, "fleet_alert": { "name": "Fleet Alert Broadcast Parser", "pattern": "\\[fleet-alert\\]\\s+(?P<severity>CRITICAL|WARN|INFO|RECOVERED):\\s+(?P<message>.+)", "flags": ["MULTILINE"], "description": "Matches infrastructure alert broadcasts dispatched into #lobby and #jobs.", "named_groups": { "severity": "CRITICAL, WARN, INFO, or RECOVERED", "message": "Alert message body" }, "test_samples": { "valid": [ "[fleet-alert] CRITICAL: VM unreachable x2 on port 22", "[fleet-alert] RECOVERED: VM 34.139.37.135 responded with 200 OK" ], "invalid": [ "[alert] CRITICAL: Missing fleet prefix", "fleet-alert: info" ] }, "usage": "Used by fleet-alert-check.sh and main-chat-watchdog.py." }, "directive": { "name": "Agent Action Directive", "pattern": "\\[Directive:\\s*(?P<directive>.+?)\\]", "flags": ["DOTALL"], "description": "Extracts operational action directives targeting autonomous agents.", "named_groups": { "directive": "Actionable directive instruction" }, "test_samples": { "valid": [ "[Directive: Take next action or close with [RESULT 7fce46e0] <summary>]", "[Directive: Run audit on node pip]" ], "invalid": [ "Directive: without brackets", "[Directive:]" ] }, "usage": "Injected into prompts by response-harvester.py and job-dispatch.py." }, "runtime_context": { "name": "Runtime Context URL", "pattern": "\\[Runtime Context:\\s*(?P<url>https?://[^\\s\\]]+)\\]", "flags": [], "description": "Extracts assistive web surface or thread URLs from message context.", "named_groups": { "url": "HTTP/HTTPS URL" }, "test_samples": { "valid": [ "[Runtime Context: https://box.muse-dev.online/thread/7fce46e0]", "[Runtime Context: https://box.muse-dev.online/api/box/fleet]" ], "invalid": [ "Runtime Context: not wrapped", "[Runtime Context: invalid-url]" ] }, "usage": "Used by assistive surfaces and browser agent navigation routines." }, "uuid": { "name": "Canonical UUID Pattern", "pattern": "\\b(?P<uuid>[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})\\b", "flags": [], "description": "Standard RFC 4122 UUID v4 detector for threads, messages, and session IDs.", "named_groups": { "uuid": "Matched UUID string" }, "test_samples": { "valid": [ "dc6d72ca-4b02-4217-bf41-7dbca19c5c24", "d410b9ad-f667-465f-a103-43fabc0f69fe" ], "invalid": [ "dc6d72ca-4b02-4217-bf41", "not-a-uuid" ] }, "usage": "Thread ID resolution in muse-chat-api.py and super-cli.py." }, "short_hex": { "name": "Short Hex Identifier", "pattern": "\\b(?P<hex>[0-9a-fA-F]{6,12})\\b", "flags": [], "description": "Matches 6-12 character hexadecimal hashes used for compact DM IDs and subagent hashes.", "named_groups": { "hex": "Hexadecimal string" }, "test_samples": { "valid": [ "7fce46e0", "04af8e15", "ca56e39199da" ], "invalid": [ "123", "abcdefghijk" ] }, "usage": "Compact ID matching across logs and DM tables." }, "subagent_update": { "name": "Subagent Update Notification", "pattern": "\\[SUBAGENT-UPDATE\\]\\s+Subagent\\s+'(?P<title>[^']+)'\\s+\\((?P<short_id>[0-9a-fA-F]+)\\)\\s+(?P<message>.+)", "flags": ["MULTILINE"], "description": "Parses status updates and milestones from background subagent executions.", "named_groups": { "title": "Subagent session title", "short_id": "Hex identifier of the subagent session", "message": "Progress update message" }, "test_samples": { "valid": [ "[SUBAGENT-UPDATE] Subagent 'exec-audit' (4a2b8e) has posted new output.", "[SUBAGENT-UPDATE] Subagent 'health-check' (12ff4a) completed successfully." ], "invalid": [ "Subagent update without brackets" ] }, "usage": "Used by self_main_loop.py subagent monitor." }, "swarm_slot": { "name": "Swarm Slot Task Marker", "pattern": "\\[JOB\\s+(?P<swarm_id>[a-zA-Z0-9_-]+)/(?P<slot>\\d+)\\]", "flags": [], "description": "Matches swarm worker slot task assignments.", "named_groups": { "swarm_id": "ID of parent swarm execution", "slot": "Index of worker slot (e.g. 0, 1, 2)" }, "test_samples": { "valid": [ "[JOB swarm-99a/0]", "[JOB swarm-4a2b/3]" ], "invalid": [ "[JOB swarm-99a]" ] }, "usage": "Used in response-harvester.py and swarm_worker." }, "contract_footer": { "name": "Contract Footer Verifier", "pattern": "Reply:\\s*\\[ACK\\s+id\\]\\s*seen\\s*\\|\\s*\\[CLAIM\\s+id\\]\\s*mine\\s*\\|\\s*\\[RESULT\\s+id\\]\\s*done\\s*\\|\\s*\\[DECLINE\\s+id\\]\\s*\\|\\s*\\[NO-ACTION\\s+id\\]\\.?", "flags": ["IGNORECASE"], "description": "Validates the presence of the standard agent contract footer in prompt envelopes.", "named_groups": {}, "test_samples": { "valid": [ "Reply: [ACK id] seen | [CLAIM id] mine | [RESULT id] done | [DECLINE id] | [NO-ACTION id]." ], "invalid": [ "Please reply when ready" ] }, "usage": "Enforced in self_main_loop.py CONTRACT_FOOTER." }, "sender_tag": { "name": "Sender Identity Tag", "pattern": "\\[from[:\\s]+(?P<sender>[a-zA-Z0-9_-]+)\\]", "flags": ["IGNORECASE"], "description": "Matches agent or operator attribution tags in chat messages.", "named_groups": { "sender": "Identity of sender" }, "test_samples": { "valid": [ "[from:super]", "[from 646]", "[from pip]" ], "invalid": [ "from super without brackets" ] }, "usage": "Used in chat-history parsing and loop attribution." } } }