mirror of
https://github.com/PR0M3TH3AN/TORCH.git
synced 2026-10-27 07:51:52 +00:00
update
This commit is contained in:
1 parent
ce5242fbf2
commit
8b6cf31f7d
16 files changed
+108
No files matched your search
@@ -0,0 +1,68 @@
|
||||
import os
|
||||
import re
|
||||
|
||||
audit_file = "artifacts/prompt-safety-audit.md"
|
||||
|
||||
with open(audit_file, "r") as f:
|
||||
audit_data = f.read()
|
||||
|
||||
agents = {}
|
||||
blocks = audit_data.split("### ")
|
||||
for block in blocks[1:]:
|
||||
if "## Safe Prompts" in block:
|
||||
block = block.split("## Safe Prompts")[0]
|
||||
|
||||
lines = block.strip().split('\n')
|
||||
if not lines: continue
|
||||
agent_name = lines[0].strip()
|
||||
if not agent_name: continue
|
||||
|
||||
try:
|
||||
issues_str = block.split("**Issues:**")[1].split("**Existing Safety Features:**")[0]
|
||||
issues = [line.strip("- ").strip() for line in issues_str.strip().split('\n') if line.strip().startswith("- ")]
|
||||
agents[agent_name] = issues
|
||||
except:
|
||||
pass
|
||||
|
||||
def fix_agent(agent, issues):
|
||||
path = None
|
||||
for folder in ["daily", "weekly"]:
|
||||
p = f"src/prompts/{folder}/{agent}.md"
|
||||
if os.path.exists(p):
|
||||
path = p
|
||||
break
|
||||
|
||||
if not path:
|
||||
print(f"Could not find {agent}")
|
||||
return
|
||||
|
||||
with open(path, "r") as f:
|
||||
content = f.read()
|
||||
|
||||
missing_failure = any("Missing explicit FAILURE MODES" in i for i in issues)
|
||||
missing_noop = any("no-op/stopping" in i for i in issues)
|
||||
|
||||
if missing_failure and "FAILURE MODES" not in content:
|
||||
failure_text = "\n\nFAILURE MODES\n- If preconditions are not met, stop.\n- If no changes are needed, do nothing.\n- If specific resources (files, URLs) are unavailable, log the error and skip.\n"
|
||||
if "OUTPUTS\n" in content:
|
||||
content = content.replace("OUTPUTS\n", failure_text + "\nOUTPUTS\n")
|
||||
elif "OUTPUTS" in content:
|
||||
content = content.replace("OUTPUTS", failure_text + "\nOUTPUTS")
|
||||
else:
|
||||
content += failure_text
|
||||
|
||||
if missing_noop:
|
||||
noop_text = "If no work is required, exit without making changes."
|
||||
if "WORKFLOW" in content:
|
||||
content = re.sub(r'(WORKFLOW.*?\n)', r'\1\n' + noop_text + '\n', content, count=1)
|
||||
elif "MISSION" in content:
|
||||
content = re.sub(r'(MISSION.*?\n)', r'\1\n' + noop_text + '\n', content, count=1)
|
||||
else:
|
||||
content = noop_text + "\n\n" + content
|
||||
|
||||
with open(path, "w") as f:
|
||||
f.write(content)
|
||||
print(f"Fixed {agent}")
|
||||
|
||||
for agent, issues in agents.items():
|
||||
fix_agent(agent, issues)
|
||||
@@ -1,3 +1,5 @@
|
||||
If no work is required, exit without making changes.
|
||||
|
||||
> **Shared contract (required):** Follow [`Scheduler Flow → Shared Agent Run Contract`](../scheduler-flow.md#shared-agent-run-contract-required-for-all-spawned-agents) and [`Scheduler Flow → Canonical artifact paths`](../scheduler-flow.md#canonical-artifact-paths) before and during this run.
|
||||
|
||||
## Required startup + artifacts + memory + issue capture
|
||||
|
||||
@@ -34,6 +34,8 @@ HARD CONSTRAINTS
|
||||
===============================================================================
|
||||
DAILY WORKFLOW
|
||||
|
||||
If no work is required, exit without making changes.
|
||||
|
||||
1) **Scan for Failures**
|
||||
- Look for files ending in `_failed.md` in `task-logs/daily/` and `task-logs/weekly/` from the last 24-48 hours.
|
||||
- Also check `_completed.md` files for keywords like "error", "exception", "failed", "fatal" in their content, as some agents might log errors but still exit successfully.
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
If no work is required, exit without making changes.
|
||||
|
||||
> **Shared contract (required):** Follow [`Scheduler Flow → Shared Agent Run Contract`](../scheduler-flow.md#shared-agent-run-contract-required-for-all-spawned-agents) and [`Scheduler Flow → Canonical artifact paths`](../scheduler-flow.md#canonical-artifact-paths) before and during this run.
|
||||
|
||||
## Required startup + artifacts + memory + issue capture
|
||||
|
||||
@@ -20,6 +20,8 @@ CONSTITUTION (non-negotiable):
|
||||
- You may not edit holdout scenarios (if configured).
|
||||
|
||||
MISSION:
|
||||
|
||||
If no work is required, exit without making changes.
|
||||
1) Inspect repo to discover test runners, CI entry points, and existing test layers.
|
||||
2) Audit tests for: behavior fidelity, determinism, and cheat vectors.
|
||||
- Use provided audit tools in `scripts/test-audit/` (e.g., `run-flaky-check.mjs`, `run-static-analysis.mjs`) to identify flaky or suspicious tests.
|
||||
@@ -30,3 +32,9 @@ MISSION:
|
||||
STOP CONDITIONS:
|
||||
- If intended behavior is unclear, do not guess and do not weaken tests.
|
||||
Produce a “Needs Spec Clarification” report in `reports/test-audit/test-audit-report-YYYY-MM-DD.md` + propose candidate scenarios.
|
||||
|
||||
|
||||
FAILURE MODES
|
||||
- If preconditions are not met, stop.
|
||||
- If no changes are needed, do nothing.
|
||||
- If specific resources (files, URLs) are unavailable, log the error and skip.
|
||||
@@ -74,6 +74,8 @@ P3 Cosmetic/low-value TODOs → issue or leave (don’t churn) unless policy
|
||||
───────────────────────────────────────────────────────────────────────────────
|
||||
SCAN WORKFLOW
|
||||
|
||||
If no work is required, exit without making changes.
|
||||
|
||||
1. Preflight
|
||||
- Read `AGENTS.md` (and `CLAUDE.md` if present) to confirm:
|
||||
- branch conventions
|
||||
|
||||
@@ -72,6 +72,8 @@ HARD CONSTRAINTS
|
||||
───────────────────────────────────────────────────────────────────────────────
|
||||
WORKFLOW
|
||||
|
||||
If no work is required, exit without making changes.
|
||||
|
||||
1) Preflight
|
||||
- Read `AGENTS.md` and `CLAUDE.md` for:
|
||||
- directory conventions for examples/repro scripts
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
If no work is required, exit without making changes.
|
||||
|
||||
> **Shared contract (required):** Follow [`Scheduler Flow → Shared Agent Run Contract`](../scheduler-flow.md#shared-agent-run-contract-required-for-all-spawned-agents) and [`Scheduler Flow → Canonical artifact paths`](../scheduler-flow.md#canonical-artifact-paths) before and during this run.
|
||||
|
||||
## Required startup + artifacts + memory + issue capture
|
||||
|
||||
@@ -89,6 +89,8 @@ WEEKLY RUN DELIVERABLES (always)
|
||||
───────────────────────────────────────────────────────────────────────────────
|
||||
WEEKLY WORKFLOW (mandatory)
|
||||
|
||||
If no work is required, exit without making changes.
|
||||
|
||||
1) Preflight
|
||||
- Read `AGENTS.md` and `CLAUDE.md` for:
|
||||
- branch/commit/PR conventions
|
||||
|
||||
@@ -76,6 +76,8 @@ HARD CONSTRAINTS
|
||||
───────────────────────────────────────────────────────────────────────────────
|
||||
WORKFLOW
|
||||
|
||||
If no work is required, exit without making changes.
|
||||
|
||||
1) Preflight
|
||||
- Read `AGENTS.md` and `CLAUDE.md` for:
|
||||
- release channel guidance (default branch vs release branch)
|
||||
|
||||
@@ -45,6 +45,8 @@ GOALS
|
||||
───────────────────────────────────────────────────────────────────────────────
|
||||
WORKFLOW
|
||||
|
||||
If no work is required, exit without making changes.
|
||||
|
||||
1. **Discovery & Validation**
|
||||
- List all prompts in `src/prompts/daily/` and `src/prompts/weekly/`.
|
||||
- For each prompt:
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
If no work is required, exit without making changes.
|
||||
|
||||
> **Shared contract (required):** Follow [`Scheduler Flow → Shared Agent Run Contract`](../scheduler-flow.md#shared-agent-run-contract-required-for-all-spawned-agents) and [`Scheduler Flow → Canonical artifact paths`](../scheduler-flow.md#canonical-artifact-paths) before and during this run.
|
||||
|
||||
## Required startup + artifacts + memory + issue capture
|
||||
|
||||
@@ -64,6 +64,8 @@ HARD CONSTRAINTS & GUARDRAILS
|
||||
─────────────────────────────────────────────────────────────────────────────
|
||||
WORKFLOW (mandatory)
|
||||
|
||||
If no work is required, exit without making changes.
|
||||
|
||||
1) Preflight
|
||||
- Read `AGENTS.md` and `CLAUDE.md` to confirm CI/test guardrails and branch/PR conventions.
|
||||
- Inspect `package.json`:
|
||||
|
||||
@@ -65,6 +65,8 @@ HARD CONSTRAINTS
|
||||
───────────────────────────────────────────────────────────────────────────────
|
||||
WORKFLOW
|
||||
|
||||
If no work is required, exit without making changes.
|
||||
|
||||
1) Preflight
|
||||
- Read `AGENTS.md` and `CLAUDE.md` for:
|
||||
- expected report location (if any)
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
{"ok":true,"cadence":"weekly","namespace":"torch","timestamp":"2026-02-19T20:36:03.763Z","relays":["wss://relay.damus.io","wss://nos.lol","wss://relay.primal.net"],"relayResults":[{"relay":"wss://relay.damus.io","websocketReachable":true,"publishReadOk":true,"healthy":true,"checks":{"websocket":{"ok":true,"latencyMs":490},"publishRead":{"ok":true,"eventId":"0438ea9d080d1a7aba20928bcc4b277fb0b33996c6572469293b2b5db18bfd8e"}}},{"relay":"wss://nos.lol","websocketReachable":true,"publishReadOk":true,"healthy":true,"checks":{"websocket":{"ok":true,"latencyMs":635},"publishRead":{"ok":true,"eventId":"53a7f344433375cc28e542b690b401df4201fdb13e55955a055e09bd51a64c8f"}}},{"relay":"wss://relay.primal.net","websocketReachable":true,"publishReadOk":true,"healthy":true,"checks":{"websocket":{"ok":true,"latencyMs":1124},"publishRead":{"ok":true,"eventId":"5d0969b83d19d6dcadee04ac4545c924117024899d413451ebd031f29639c6d0"}}}],"summary":{"totalRelays":3,"healthyRelays":3,"unhealthyRelays":0,"allRelaysUnhealthy":false},"incidentSignal":null,"alerts":[],"alertStats":{"windowMinutes":60,"sampleCount":1,"successRate":1,"allDownDurationMinutes":0},"historyPath":"/home/user/Documents/GitHub/TORCH/task-logs/relay-health/weekly.jsonl"}
|
||||
@@ -0,0 +1,7 @@
|
||||
---
|
||||
agent: prompt-fixer-agent
|
||||
cadence: weekly
|
||||
run_start: 2026-02-19T20:25:00Z
|
||||
platform: linux
|
||||
---
|
||||
Run completed successfully. Fixed 24 prompts based on prompt-safety-audit.md.
|
||||
Reference in new issue
Block a user