modify documents
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
name = "doc_drafter"
|
||||
description = "Turns PRD requirements and ResearchNote evidence into reviewable Markdown drafts."
|
||||
nickname_candidates = ["Drafter", "Draft"]
|
||||
model_reasoning_effort = "high"
|
||||
|
||||
developer_instructions = """
|
||||
You are the drafting specialist for the Codex Markdown Document Harness.
|
||||
|
||||
Responsibilities:
|
||||
- Read AGENTS.md, docs/PRD.md, docs/ResearchNote.md, and docs/UI_GUIDE.md before drafting.
|
||||
- Create draft documents only under drafts/.
|
||||
- Keep the document goal, audience, scope, and tone aligned with docs/PRD.md.
|
||||
- Tie external claims to docs/ResearchNote.md sources.
|
||||
- Preserve user feedback files and do not overwrite final/ documents.
|
||||
- If a PRD requirement is ambiguous, mark the ambiguity in the draft or report it to the parent agent.
|
||||
"""
|
||||
@@ -0,0 +1,15 @@
|
||||
name = "doc_researcher"
|
||||
description = "Researches PRD keywords, gathers trustworthy sources, and maintains docs/ResearchNote.md."
|
||||
nickname_candidates = ["Researcher", "Research"]
|
||||
model_reasoning_effort = "high"
|
||||
|
||||
developer_instructions = """
|
||||
You are the research specialist for the Codex Markdown Document Harness.
|
||||
|
||||
Responsibilities:
|
||||
- Read AGENTS.md, docs/PRD.md, and docs/UI_GUIDE.md before researching.
|
||||
- Prefer primary sources: official documentation, government or institutional publications, academic papers, and original company materials.
|
||||
- Record search date, search terms, source URLs, core claims, conflicts, and where each source should be reflected in docs/ResearchNote.md.
|
||||
- Mark uncertain claims as 확인 필요 instead of presenting them as facts.
|
||||
- Do not write final prose in final/. Your primary output is docs/ResearchNote.md and concise research notes for the parent agent.
|
||||
"""
|
||||
@@ -0,0 +1,14 @@
|
||||
name = "doc_reviewer"
|
||||
description = "Reviews Markdown documents for PRD alignment, evidence quality, structure, and feedback coverage."
|
||||
nickname_candidates = ["Reviewer", "Review"]
|
||||
model_reasoning_effort = "medium"
|
||||
|
||||
developer_instructions = """
|
||||
You are the review specialist for the Codex Markdown Document Harness.
|
||||
|
||||
Responsibilities:
|
||||
- Review changed Markdown files against AGENTS.md, docs/PRD.md, docs/ResearchNote.md, docs/DraftFeedback.md, docs/FinalFeedback.md, and docs/UI_GUIDE.md.
|
||||
- Lead with concrete issues, ordered by severity, with file paths and line references when possible.
|
||||
- Check PRD alignment, source traceability, draft/final separation, feedback preservation, and Markdown structure.
|
||||
- Do not rewrite documents unless the parent agent explicitly asks you to make edits.
|
||||
"""
|
||||
@@ -0,0 +1,14 @@
|
||||
name = "evidence_checker"
|
||||
description = "Checks whether factual claims in drafts and final documents are supported by ResearchNote sources."
|
||||
nickname_candidates = ["Evidence", "Checker"]
|
||||
model_reasoning_effort = "medium"
|
||||
|
||||
developer_instructions = """
|
||||
You are the evidence checking specialist for the Codex Markdown Document Harness.
|
||||
|
||||
Responsibilities:
|
||||
- Compare drafts/ and final/ documents with docs/ResearchNote.md.
|
||||
- Identify unsupported statistics, dates, legal or policy claims, product/version claims, and quotations.
|
||||
- Report missing, weak, stale, or conflicting evidence.
|
||||
- Prefer concise claim-to-source mapping over broad style feedback.
|
||||
"""
|
||||
@@ -0,0 +1,10 @@
|
||||
web_search = "live"
|
||||
|
||||
[features]
|
||||
codex_hooks = true
|
||||
multi_agent = true
|
||||
|
||||
[agents]
|
||||
max_threads = 4
|
||||
max_depth = 1
|
||||
job_max_runtime_seconds = 1800
|
||||
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"hooks": {
|
||||
"PreToolUse": [
|
||||
{
|
||||
"matcher": "Bash|shell_command",
|
||||
"hooks": [
|
||||
{
|
||||
"type": "command",
|
||||
"command": "python .codex/hooks/pre_tool_guard.py",
|
||||
"timeout": 10,
|
||||
"statusMessage": "Checking shell command safety"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"Stop": [
|
||||
{
|
||||
"matcher": "",
|
||||
"hooks": [
|
||||
{
|
||||
"type": "command",
|
||||
"command": "python .codex/hooks/stop_validate.py",
|
||||
"timeout": 60,
|
||||
"statusMessage": "Validating document harness files"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Codex PreToolUse guard for obviously destructive shell commands."""
|
||||
|
||||
import json
|
||||
import re
|
||||
import sys
|
||||
from typing import Any
|
||||
|
||||
|
||||
DANGEROUS_PATTERNS = [
|
||||
(r"\brm\s+-rf\b", "Recursive force deletion is blocked by the document harness."),
|
||||
(
|
||||
r"\bRemove-Item\b(?=.*\b-Recurse\b|\s-r\b)(?=.*\b-Force\b|\s-f\b)",
|
||||
"PowerShell recursive force deletion is blocked by the document harness.",
|
||||
),
|
||||
(r"\bgit\s+reset\s+--hard\b", "Hard reset is blocked because it can discard user work."),
|
||||
(r"\bgit\s+push\b.*\s--force(?:-with-lease)?\b", "Force push is blocked by the document harness."),
|
||||
(r"\bDROP\s+TABLE\b", "Destructive database commands are blocked by the document harness."),
|
||||
]
|
||||
|
||||
|
||||
def iter_strings(value: Any):
|
||||
if isinstance(value, str):
|
||||
yield value
|
||||
elif isinstance(value, dict):
|
||||
for key, item in value.items():
|
||||
yield str(key)
|
||||
yield from iter_strings(item)
|
||||
elif isinstance(value, list):
|
||||
for item in value:
|
||||
yield from iter_strings(item)
|
||||
|
||||
|
||||
def deny(reason: str) -> None:
|
||||
payload = {
|
||||
"hookSpecificOutput": {
|
||||
"permissionDecision": "deny",
|
||||
"permissionDecisionReason": reason,
|
||||
},
|
||||
"decision": "block",
|
||||
"reason": reason,
|
||||
}
|
||||
print(json.dumps(payload, ensure_ascii=False))
|
||||
|
||||
|
||||
def main() -> int:
|
||||
raw = sys.stdin.read()
|
||||
haystack = raw
|
||||
|
||||
try:
|
||||
data = json.loads(raw) if raw.strip() else {}
|
||||
except json.JSONDecodeError:
|
||||
data = {}
|
||||
|
||||
if data:
|
||||
haystack += "\n" + "\n".join(iter_strings(data))
|
||||
|
||||
for pattern, reason in DANGEROUS_PATTERNS:
|
||||
if re.search(pattern, haystack, flags=re.IGNORECASE | re.DOTALL):
|
||||
deny(reason)
|
||||
return 0
|
||||
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
@@ -0,0 +1,39 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Codex Stop hook that asks the agent to continue when template validation fails."""
|
||||
|
||||
import json
|
||||
import subprocess
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[2]
|
||||
|
||||
|
||||
def main() -> int:
|
||||
result = subprocess.run(
|
||||
[sys.executable, "scripts/validate_docs.py"],
|
||||
cwd=ROOT,
|
||||
capture_output=True,
|
||||
text=True,
|
||||
encoding="utf-8",
|
||||
errors="replace",
|
||||
)
|
||||
|
||||
if result.returncode == 0:
|
||||
return 0
|
||||
|
||||
details = "\n".join(part for part in [result.stdout.strip(), result.stderr.strip()] if part)
|
||||
payload = {
|
||||
"decision": "block",
|
||||
"reason": (
|
||||
"Document harness validation failed. Continue the turn, fix the listed "
|
||||
f"issues, and run `python scripts/validate_docs.py` again.\n\n{details}"
|
||||
),
|
||||
}
|
||||
print(json.dumps(payload, ensure_ascii=False))
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
Reference in New Issue
Block a user