Flows category icon
Harness Engineering
Intermediate

Design Layered Tool Prompts with Preference Chains

Structure your tool prompts the way the leading harness does: preference chains up front, usage constraints in the middle, NEVER-guarded safety protocols at the end.

4 steps12 verify checks60-90 minutesWorks with: emergent · chatgpt · claude · cursor
Start Guided Walkthrough

The Route

0/4 verified

Context Pack

Paste this first. It briefs the AI on requirements, constraints, and the Definition of Done before your first build prompt.

Context Pack
PROJECT CONTEXT:
My agent's tool descriptions are a wall of unordered text, and the model keeps using raw shell commands where dedicated tools exist. Claude Code's BashTool prompt shows a deliberate three-layer structure whose ordering and wording are engineered, not accidental.

GOAL:
Rewrite a tool prompt as three ordered layers - preference chain, usage constraints, safety protocols - using positive alternatives, precise NEVER rules, and experience-based framing.

REQUIREMENTS:
- A three-layer prompt: preferences first, usage rules second, safety protocols last
- Every prohibition paired with a positive alternative ('Use Edit, NOT sed')
- NEVER rules reserved for destructive operations, each with an explicit-user-request exception
- Guidance framed as better experience or better results, not as 'security'
- Most-frequently-needed rules placed first to maximize attention

CONSTRAINTS:
- Prompt rules are soft guidance - anything that must never happen also needs a code-level check
- Keep the prompt ASCII and terse; every line must earn its tokens

DEFINITION OF DONE:
- The rewritten prompt has three visibly distinct layers in the intended order
- Each 'do not' names the preferred alternative in the same line
- Destructive operations are covered by NEVER rules with explicit exceptions
- A/B transcripts show the model choosing dedicated tools over raw commands more often

COMMON FAILURES TO AVOID:
- One flat list where preferences, mechanics, and safety rules interleave randomly
- Bare prohibitions ('do not use sed') with no alternative, leaving the model to guess
- NEVER used for trivia, diluting its force for the operations that matter
- Safety rules framed so heavily the model refuses routine safe work

Paste this into your AI builder first. It teaches the AI what you want before you give it the build prompt.

Related routes

More Harness Engineering flows that share ground with this one.

Flows category icon
Harness Engineering

Pair Every Prompt Rule with a Code Backstop

Prompts guide, code enforces: inventory your agent's soft rules, back each critical one with an independent deterministic check, and define the allow/ask/deny escalation.

01Inventory soft rules and classify enforcement needs
02Implement checks independent of the prompt
03Wire the escalation path

+1 more steps to Done

Best forproduction-grade builds with strict verification

4 steps120-180 minutesAdvanced
Flows category icon
Harness Engineering

Assemble Tool Prompts Dynamically per Environment

Stop shipping one static mega-prompt: generate tool prompts from environment conditions, inject blocks only when features are on, and dedupe config to save tokens.

01Identify conditional blocks
02Build the prompt generator
03Dedupe and budget every block

+1 more steps to Done

Best forproduction-grade builds with strict verification

4 steps90-120 minutesAdvanced
Flows category icon
Harness Engineering

Hook a Permission Layer onto Dangerous Tools

Intercept dangerous tool calls with a hook layer: pattern rules, approval gates, and blocks that the model cannot talk its way past.

01Define the danger rule set
02Implement the hook point
03Harden the patterns against evasion

+1 more steps to Done

Best forbuilders who have shipped a basic app before

4 steps60-90 minutesIntermediate

Made with Emergent