Understand the worker prompt layers
Status: Ready
Article ID: 049
Truth label: Current
Audience: System designer
Reader outcome: Separate task identity, repository controls, personas, skills, session context, and retrieved history by authority and purpose.
Related articles: 007, 036, 073
Target week: 20
Last verified: 2026-09-13
Technical reviewer: Codex source audit
Editorial reviewer: Codex editorial audit
Start with stable identity
The prompt names the task, project, path, run, attempt, engine context, and requested outcome. Stable identity prevents a capable agent from solving the right kind of problem in the wrong repository or task record.
Keep instructions reviewable
Repository controls and active rules are instruction layers. A short worker persona supplies role emphasis. Selected skill instructions add bounded workflow guidance. The adapter uses a system prompt when supported or folds the persona into the prompt when it is not.
Enforce reporting contracts
The worker wraps execution prompts with two critical reporting layers:
- Reporting contract at the top: Sits first in the prompt to set
expectations. It explicitly forbids deferring the reader to repository files
(such as telling an operator to read the changelog instead) and requires ending the
report with a clean
## PR descriptionsection containing a one-line title and body. - Reporting reminder at the end: Closes every prompt after all rules, skills, and context blocks. Because prompt recency drives compliance, this final reminder reiterates that writing repository records does not discharge the obligation to provide a complete, stand-alone report.
Fit the layers to a budget
The assembled prompt is measured against the worker's context budget profile before dispatch. The task, repository controls, rules, persona or method, and selected skills are protected: if they do not fit, the attempt stops with an error naming the required size rather than silently cutting a constraint. Optional material is dropped as whole blocks, oldest history first. The attempt records its allocation so you can read which sections reached the model. See Settings and budgets.
Label context as evidence
Completed session work, past outcomes, and CPMI history are bounded and marked as untrusted reference material. They can inform the task but cannot override current repository controls or the explicit user goal.
Inspect the manifest
Worker traces record prompt shape, section sizes, hashes, permission, and raw artifact references. Review those fields when context appears missing or too large. Do not publish the raw prompt artifact.
Current limits
Prompt layering reduces ambiguity but cannot guarantee model obedience. Repository controls can themselves be unsafe, and retrieved history can be stale. Raw prompts can contain confidential material and remain worker-local.
Next lesson
Continue with Add a new CLI adapter.
Derivative map
- Weekly package: WEEK-20
- Long video: VIDEO-W20-LONG
- Shorts: SHORT-W20-PROBLEM, SHORT-W20-MECHANISM, SHORT-W20-WARNING
- Email: EMAIL-W20
- LinkedIn: LI-W20-A, LI-W20-B
- X: X-W20-A, X-W20-B
- Visual: VISUAL-W20
Review record
- Identity, persona, skill, rule, session, learning, CPMI, and trace layers checked against current source.
- Obedience, stale-history, unsafe-control, and raw-prompt limits reviewed.
- Lesson separates instructions from evidence.
- Internal links and repository voice reviewed.
Review completed: 2026-09-03
Re-audited against the running product: 2026-09-13