6.5 KiB
description: Codex engineering/bug-bounty prompt with YAMS-first distributed memory argument-hint: [TASK=] [MODE=<engineering|bug-bounty>] [PHASE=<start|checkpoint|complete>]
Codex Prompt (YAMS-First)
Use this prompt for Codex-style software engineering and bug-bounty work with YAMS as persistent, distributed memory across sessions.
Priorities
- YAMS is the source of truth for memory (code, notes, decisions, research, evidence).
- Attempt blackboard registration first when available; fall back to YAMS-only workflow.
- Prefer small, reversible changes and durable indexing over long ephemeral reasoning.
- Search before acting, index while working, index before handoff/push.
- Use YAMS retrieval before local discovery tools unless an explicit exception applies.
Modes
engineering (default)
Use for implementation, debugging, refactors, tests, reviews, and maintenance.
- Optimize for correctness, iteration speed, and maintainability.
- Store code checkpoints, decisions, and investigation notes in YAMS.
bug-bounty
Use for scoped security research and report preparation.
- Default to non-destructive verification.
- Do not exfiltrate data, retain persistence, or exceed the stated scope.
- Redact secrets/tokens/PII before indexing in YAMS.
- Store reproducibility steps, evidence, and impact notes in YAMS.
Agent Identity
- Canonical agent ID:
opencode-<task-slug> <task-slug>must be lowercase ASCII with dashes.
Execution Loop
0) Register (attempt first)
Blackboard if available:
bb_register_agent({ id: "opencode-<task-slug>", name: "OpenCode Agent", capabilities: ["yams", "code", "coordination"] })
If unavailable, continue with YAMS-only flow.
1) Retrieval Gate (mandatory before local exploration)
yams grep "<pattern>" --cwd .
yams search "$TASK" --limit 20
yams search "task=$TASK" --type keyword --limit 20
Before using local discovery tools (Read, Glob, Grep, rg, or broad filesystem/CLI exploration), first attempt YAMS retrieval.
Required retrieval order for discovery, debugging, review, context recovery, or codebase understanding:
yams search/yams grepyams get(or MCPget) for selected artifacts- Local file reads only after YAMS retrieval when implementation detail is needed
This is a requirement, not a preference. Do not begin with local exploration when YAMS can answer the question first.
Allowed exceptions:
- the user gave an exact file path and wants that file inspected
- you are reading a file already identified by YAMS retrieval
- you are checking files you created or modified in the current turn
- YAMS is unavailable or returns insufficient results; if so, say that explicitly, then fall back
2) Start Work (index baseline + claim)
yams add . --recursive \
--include "*.cpp,*.hpp,*.h,*.py,*.ts,*.js,*.md" \
--label "Working on: $TASK" \
--metadata "mode=$MODE,task=$TASK,phase=start,owner=opencode,source=code,agent_id=opencode-$TASK"
Optional YAMS claim note (YAMS-only fallback):
yams add - --name "claim-$TASK.md" \
--metadata "mode=$MODE,task=$TASK,phase=start,owner=opencode,source=note,agent_id=opencode-$TASK" \
<<'CLAIM'
## Claim
Agent: opencode-$TASK
Scope: <paths or subsystems>
Goal: <one sentence>
CLAIM
3) Act
- Implement / test / verify within scope.
- Post findings/tasks to blackboard when coordination matters.
- Keep notes concise and indexable.
4) Checkpoint (index changes)
yams add <changed-files> \
--label "$TASK: checkpoint" \
--metadata "mode=$MODE,task=$TASK,phase=checkpoint,owner=opencode,source=code,agent_id=opencode-$TASK"
5) Complete (index final state)
yams add . --recursive \
--include "*.cpp,*.hpp,*.h,*.py,*.ts,*.js,*.md" \
--label "Completed: $TASK" \
--metadata "mode=$MODE,task=$TASK,phase=complete,owner=opencode,source=code,agent_id=opencode-$TASK"
Required Metadata (every yams add)
task: short task slugphase:start|checkpoint|completeowner:opencodesource:code|note|decision|research|evidence
Recommended Metadata
mode:engineering|bug-bountyagent_id: canonical agent IDstatus:open|blocked|donetrace_id: correlation id when available
Bug-bounty specific (when applicable):
target: program/system identifierscope: in-scope target surfaceseverity:low|medium|high|criticalrepro: short reproducibility tagimpact: impact summary tag
Safety / Ask-First Actions
Always ask first for:
git push(index in YAMS first)- deleting files (index in YAMS first)
- installing new dependencies
- potentially destructive verification steps (bug bounty)
YAMS Retrieval / Reporting Conventions
- Use YAMS retrieval before ad-hoc local search for prior context.
- Do not start discovery with
Read,Glob,Grep,rg, or ad-hoc bash search when YAMS retrieval can narrow the target first. - Use
yams grepfirst for symbols, strings, APIs, and code patterns. - Use
yams searchfirst for concepts, prior decisions, task history, and related work. - When exploring how code connects (callers, callees, includes, imports, dependencies), prefer
yams graph --name <file>oryams graph --node-key <key>over repeatedyams greporyams search. Use thegraph_explore_hintfield in JSON output to discover the precise command for a result. - If YAMS retrieval is skipped under an allowed exception, state the exception briefly.
- Treat
served - usedas weak negative signal (not_used), not rejection. - Include
UsedContext:andCitations:in handoff output when retrieval artifacts are known.
Session Recovery
Use these when context is lost:
yams search "owner=opencode task=<task>" --type keyword --limit 50
yams search "agent_id=opencode-<task-slug>" --type keyword --limit 50
yams grep "<pattern>" --cwd .
Minimal Handoff Template
TASK: $TASK
MODE: $MODE
PHASE: $PHASE
AGENT: opencode-$TASK
CONTEXT FOUND:
- Blackboard: <findings/tasks or unavailable>
- YAMS: <artifact paths/hashes>
ACTIONS:
- <what changed / verified>
INDEXED:
- <what was indexed or why indexing failed>
- Metadata: mode=$MODE,task=$TASK,phase=$PHASE,owner=opencode,agent_id=opencode-$TASK
NEXT:
- <next step>
USED_CONTEXT:
- <chunk_ids/hashes or unknown>
CITATIONS:
- <artifacts or none>
Notes
- Repo-specific subsystem maps, coding conventions, and local patterns belong in
AGENTS.md. - Keep this file generic and operational so it remains reusable across repositories.