Skip to content

Prompts opencode style#837

Open
harshithmullapudi wants to merge 6 commits into
mainfrom
prompts-opencode-style
Open

Prompts opencode style#837
harshithmullapudi wants to merge 6 commits into
mainfrom
prompts-opencode-style

Conversation

@harshithmullapudi
Copy link
Copy Markdown
Member

No description provided.

harshithmullapudi and others added 6 commits May 1, 2026 17:16
…ion agent, channel formats

Brings BASE_CONTEXT, decision-prompt, and channel-formats in line with the
opencode prompting style already adopted in capabilities.ts: markdown
section headers, bulleted rules, IMPORTANT/NEVER callouts, backticked
tool names, and <example>-tagged traces. No business-logic changes —
every existing rule is preserved.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ules

Codex review caught three regressions in the opencode-style rewrite of
capabilities.ts:

- [P1] Ambiguous-timing tasks must be Waiting, not Todo. Top-level Todo
  enters the 2-minute prep flow and starts executing before the user
  answers; Waiting is the contract for SIMPLE+UNCLEAR.
- [P2] Readiness check oversimplified — the EXCEPTION block for
  deferrable items (book hotel, set up meeting) needs to persist intent
  via create_task(status="Waiting") so unblock_task can resume after the
  user replies.
- [P2] create_task(status="Ready") does not bypass the prep buffer for
  agent-created tasks; it still gets the same 2-minute buffer as Todo.

Restores the full four-cases classifier (GOAL/PLAN × CLEAR/UNCLEAR), the
COMPLEXITY check, the WHAT-NOT-TO-ASK-ABOUT silent-resolve rules, and
the Pattern statement — all in opencode-style structure.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Restructure the Core brain system prompt so its top-level shape mirrors
opencode/anthropic.txt section-for-section, with CORE business rules
filling each section.

Assembly order (linear, no XML envelopes):
  1. Opener: identity + IMPORTANT integrations rule + help bullets
     + self-reference paragraph (BASE_CONTEXT in personality.ts)
  2. # Tone and style — slotted voice variant
  3. # Behavior — ownership, information transform rules, bias toward
     action, media, memory, conversation flow (relocated from the old
     BASE_CONTEXT XML blocks; rewritten in opencode bullet/callout
     grammar but every business rule preserved)
  4. # Tool usage policy — gather_context, take_action, send_message,
     add_comment, internal task tools, set_timezone, parallel calls
  5. # Confirmation — irreversible vs reversible + when-to-ask + opt-outs
  6. # Readiness check — clarify before acting, EXCEPTION block,
     What NOT to ask about, Do ask when, Pattern, When you think
     you have it
  7. # Task Management — modes, lifecycle, approval flow, subtasks,
     when to create, description updates, approving vs creating
  8. # Doing tasks — FOUR CASES classifier, COMPLEXITY check, routing
  9. # Coding tasks — gateway delegation, feature/bug-fix tracks
 10. # Skills — using/creating/updating
 11. # Standing delegations — recurring ownership pattern
 12. # Scheduling and reminders
 13. # Gateways — capability routing + web-vs-browser
 14. # Daily scratchpad — @mention vs proactive + scratchpad-vs-tasks
 15. # Channel format — per-channel rules (selected at runtime)

No business rule was dropped. Content that previously lived in
<identity>/<ownership>/<tools>/<information>/<behavior>/<mission>
XML blocks now lives under named sections that follow opencode's
header + paragraph + bullets + <example> grammar. Voice variants
retain their internal XML blocks for now (separate cleanup if
desired).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Codex review caught two regressions in the opencode-shape restructure:

- [P1] Help-fallback misrouting (personality.ts): "If the user asks
  for help..." was too broad — fired on every "help me draft this"
  request, advertising /help and the GitHub issue tracker instead of
  doing the work. Scope it to "help with CORE itself" and add an
  explicit carve-out for everyday task requests.

- [P2] Stale <capabilities> anchors: three downstream prompt fragments
  in context.ts (PREP RULES) and task-tools.ts (status field) literally
  referenced "<capabilities>" as an anchor. After dropping the outer
  XML wrapper in the restructure, those references pointed at nothing.
  Updated each to reference the new opencode-style section names
  (**Doing tasks** > Input shape, **Complexity**, **Readiness check**)
  so background/task runs can still find the rules.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Switch back from `# Markdown headers` to `<xml_tag>...</xml_tag>` for
top-level section delimiters in the assembled system prompt. Anthropic's
prompt-engineering guide recommends XML for Claude (unambiguous open/close
boundaries, durable cross-references, cleaner nesting), and the codex
review of the previous restructure caught a real regression caused by
losing `<capabilities>` as an anchor.

Top-level tags introduced (snake_case lowercase, matching the original
CORE convention):
  <tone_and_style>      (slotted by personality.ts around the voice variant)
  <behavior>            (information transform, bias, ownership, memory, conversation flow)
  <tool_usage_policy>   (gather_context, take_action, send_message, etc.)
  <confirmation>
  <readiness_check>     (with EXCEPTION + How to ask + What NOT to ask + Pattern + When you think you have it)
  <task_management>     (modes, lifecycle, approval flow, subtasks, description updates, approving vs creating)
  <doing_tasks>         (FOUR CASES classifier + COMPLEXITY check + Routing + worked examples)
  <coding_tasks>
  <skill_management>    (renamed from <skills> to avoid collision with the runtime <skills> list)
  <standing_delegations>
  <scheduling>
  <gateways>
  <daily_scratchpad>
  <channel_format>      (selected at runtime by index.ts)

Sub-rules inside each section stay as `**bold**` markdown bullets per
Anthropic's recommendation — XML wraps the boundary, markdown handles
the body. `<example>` blocks are preserved unchanged.

Cross-references updated:
  context.ts:  "see <doing_tasks>", "see <readiness_check>"
  task-tools.ts: "rules in <doing_tasks>"

No business logic changes. Voice variants still carry their own internal
XML structure (`<voice>`, `<writing>`, `<cut-the-fat>`, `<examples>`,
`<never-say>`) inside the new `<tone_and_style>` wrapper.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@harshithmullapudi harshithmullapudi self-assigned this May 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant