Flows category icon
Agent Architecture
Intermediate

Assemble a System Prompt Like the Pros

Structure your agent's system prompt the way leading harnesses do: layered sections, dynamic context, and enforceable rules.

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 system prompt is a wall of text that grew by accretion. Analyses of production harnesses show system prompts are assembled programmatically from layered sections: identity, rules, tool guidance, environment, and dynamic state.

GOAL:
Rebuild my system prompt as a structured, programmatic assembly with static layers, dynamic sections, and rules the harness can actually enforce.

REQUIREMENTS:
- The prompt decomposed into named sections: identity, capabilities, hard rules, tool guidance, environment, dynamic state
- An assembler function that builds the prompt from sections at runtime
- Dynamic sections (cwd, git status, date, active plan) injected fresh per session or turn
- Hard rules written as testable statements paired with harness-side enforcement where possible
- A token budget per section with measurement

CONSTRAINTS:
- No section may duplicate another's job - one home per instruction
- Behavioral rules that can be enforced in code should also be enforced in code

DEFINITION OF DONE:
- The assembled prompt renders from sections with a visible per-section token report
- Dynamic state (cwd, date, plan) is correct at runtime, not baked in
- Each hard rule maps to either a test case or a harness enforcement point
- Removing any single section produces a measurable behavior change (sections earn their tokens)

COMMON FAILURES TO AVOID:
- One monolithic prompt where nobody knows which line does what
- Stale baked-in facts (dates, paths) contradicting reality at runtime
- Rules stated in the prompt but violated freely because nothing enforces them
- Prompt bloat: sections kept out of superstition rather than measured value

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

Related routes

More Agent Architecture flows that share ground with this one.

Flows category icon
Agent Architecture

Design a Single-Loop Agent

Build the core agent loop the leading coding agents use: one model, one loop, tools in, results folded back into context.

01Define the loop contract
02Build the tool registry
03Implement the loop with result folding

+2 more steps to Done

Best forproduction-grade builds with strict verification

5 steps90-150 minutesAdvanced
Flows category icon
Agent Architecture

Add a Plan/Todo System to Your Agent

Give your agent the planning discipline of the leading harnesses: an explicit, model-visible todo list that survives long tasks.

01Design the todo data model and tool
02Render the plan into context every turn
03Enforce plan-first and completion gates

+1 more steps to Done

Best forbuilders who have shipped a basic app before

4 steps60-90 minutesIntermediate
Flows category icon
Agent Architecture

Sub-Agent Delegation with Context Isolation

Delegate bounded work to sub-agents that run in fresh context and return only distilled results - the pattern behind scalable long tasks.

01Specify the delegation contract
02Implement the isolated sub-loop
03Wire dispatch into the parent and distill

+1 more steps to Done

Best forproduction-grade builds with strict verification

4 steps90-150 minutesAdvanced

Made with Emergent