Agentic AI Atlasby a5c.ai
OverviewWikiGraphFor AgentsEdgesSearchWorkspace
/
GitHubDocsDiscord
iiRecord
Agentic AI Atlas · Prompt Phrasing Implementation Guide
page:docs-harness-features-backlog-gaps-prompt-engineering-prompt-phrasing-implementationa5c.ai
Search record views/
Record · tabs

Available views

II.Record viewspp. 1 - 1
overviewarticlejsongraph
II.
Page JSON

page:docs-harness-features-backlog-gaps-prompt-engineering-prompt-phrasing-implementation

Structured · live

Prompt Phrasing Implementation Guide json

Inspect the normalized record payload exactly as the atlas UI reads it.

File · wiki/docs/harness-features-backlog/gaps/prompt-engineering/prompt-phrasing-implementation.mdCluster · wiki
Record JSON
{
  "id": "page:docs-harness-features-backlog-gaps-prompt-engineering-prompt-phrasing-implementation",
  "_kind": "Page",
  "_file": "wiki/docs/harness-features-backlog/gaps/prompt-engineering/prompt-phrasing-implementation.md",
  "_cluster": "wiki",
  "attributes": {
    "nodeKind": "Page",
    "sourcePath": "docs/harness-features-backlog/gaps/prompt-engineering/PROMPT-PHRASING-IMPLEMENTATION.md",
    "sourceKind": "repo-docs",
    "title": "Prompt Phrasing Implementation Guide",
    "displayName": "Prompt Phrasing Implementation Guide",
    "slug": "docs/harness-features-backlog/gaps/prompt-engineering/prompt-phrasing-implementation",
    "articlePath": "wiki/docs/harness-features-backlog/gaps/prompt-engineering/PROMPT-PHRASING-IMPLEMENTATION.md",
    "article": "\n# Prompt Phrasing Implementation Guide\n\n**Purpose**: Concrete, copy-paste-ready prompt sections to add to `packages/sdk/src/prompts/`.\nEach section below is a babysitter-adapted version of CC prompt patterns from\n[11-prompt-phrasing-analysis.md](../../11-prompt-phrasing-analysis.md).\n\n**Where these go**: New `.md` template files in `packages/sdk/src/prompts/templates/` with\ncorresponding render functions in `packages/sdk/src/prompts/parts/`. The composer\n(`compose.ts`) injects them into task prompts based on task kind.\n\n---\n\n## 1. Coding Philosophy (GAP-PROMPT-008)\n\n**File**: `packages/sdk/src/prompts/templates/coding-philosophy.md`\n**Inject when**: Task kind is `agent` and task involves code changes (detect via labels or title keywords)\n\n```markdown\n## Coding Philosophy\n\nYou are performing a delegated coding task within an orchestrated process.\nFollow these principles:\n\n- Do NOT add features, refactor code, or make \"improvements\" beyond what the task\n  description asks for. A bug fix does not need surrounding code cleaned up. A\n  simple feature does not need extra configurability.\n- Do NOT add docstrings, comments, or type annotations to code you did not change.\n  Only add comments where the logic is not self-evident.\n- Do NOT add error handling, fallbacks, or validation for scenarios that cannot\n  happen. Trust internal code and framework guarantees. Only validate at system\n  boundaries (user input, external APIs).\n- Do NOT create helpers, utilities, or abstractions for one-time operations. Do not\n  design for hypothetical future requirements. Three similar lines of code is\n  better than a premature abstraction.\n- Do NOT use backwards-compatibility hacks (renaming unused `_vars`, re-exporting\n  types, adding `// removed` comments). If something is unused, delete it.\n- If an approach fails, diagnose why before switching tactics. Read the error,\n  check your assumptions, try a focused fix. Do not retry the identical action\n  blindly, but do not abandon a viable approach after a single failure either.\n- Prefer editing existing files over creating new ones. Do not create files unless\n  absolutely necessary.\n- The right amount of complexity is what the task actually requires -- no\n  speculative abstractions, but no half-finished implementations either.\n```\n\n---\n\n## 2. Tool Preference Rules (GAP-PROMPT-009)\n\n**File**: `packages/sdk/src/prompts/templates/tool-preferences.md`\n**Inject when**: Task uses agentic tools (Pi sessions, delegated harness invocations with tool access)\n\n```markdown\n## Tool Usage Rules\n\nUse dedicated tools instead of shell commands when available:\n\n- **Read files**: Use the Read/file-read tool, NOT `cat`, `head`, `tail`, or `sed`\n- **Edit files**: Use the Edit/file-edit tool, NOT `sed` or `awk`\n- **Create files**: Use the Write/file-write tool, NOT `echo` redirection or heredocs\n- **Search by filename**: Use Glob/find-files, NOT `find` or `ls`\n- **Search file contents**: Use Grep/search, NOT `grep` or `rg` commands\n- **Shell/Bash**: Reserve for system commands and operations that have no dedicated\n  tool equivalent\n\nWhen editing a file, you MUST read it first to understand existing content.\nDo not blindly overwrite files.\n\nWhen delegating to a subagent, brief it like a colleague who just walked in:\nexplain what you are trying to accomplish, what you have already learned or ruled\nout, and give enough context for the agent to make judgment calls. Never delegate\nunderstanding -- do not write \"based on your findings, fix the bug.\" Include what\nspecifically to change.\n```\n\n---\n\n## 3. Safety and Reversibility (GAP-PROMPT-010)\n\n**File**: `packages/sdk/src/prompts/templates/safety-guidelines.md`\n**Inject when**: All agent tasks (always include)\n\n```markdown\n## Safety and Reversibility\n\nCarefully consider the reversibility and blast radius of actions before executing\nthem.\n\n**Freely take**: Local, reversible actions like editing files, running tests,\nreading code, running builds.\n\n**Confirm before taking**: Actions that are hard to reverse, affect shared systems,\nor could be destructive:\n\n- **Destructive**: Deleting files/branches, dropping database tables, killing\n  processes, `rm -rf`, overwriting uncommitted changes\n- **Hard to reverse**: Force-pushing, `git reset --hard`, amending published\n  commits, removing/downgrading packages, modifying CI/CD pipelines\n- **Visible to others**: Pushing code, creating/closing PRs or issues, sending\n  messages to external services, modifying shared infrastructure\n\nWhen you encounter an obstacle, do not use destructive actions as a shortcut.\nIdentify root causes and fix underlying issues rather than bypassing safety checks.\nIf you discover unexpected state (unfamiliar files, branches, configuration),\ninvestigate before deleting or overwriting -- it may represent in-progress work.\n\n**Security**: Do not introduce vulnerabilities (command injection, XSS, SQL\ninjection). If you notice insecure code, fix it immediately. Prioritize safe,\nsecure, and correct code.\n```\n\n---\n\n## 4. Output Efficiency (GAP-PROMPT-011)\n\n**File**: `packages/sdk/src/prompts/templates/output-efficiency.md`\n**Inject when**: All agent tasks (always include -- reduces token waste)\n\n```markdown\n## Output Efficiency\n\nGo straight to the point. Try the simplest approach first. Do not overdo it.\n\n- Lead with the answer or action, not the reasoning\n- Skip filler words, preamble, and unnecessary transitions\n- Do not restate what was asked -- just do it\n- If you can say it in one sentence, do not use three\n\nFocus output on:\n- Decisions that need input\n- High-level status updates at milestones\n- Errors or blockers that change the plan\n\nDo not narrate your thought process step by step. Do not summarize what you just\ndid after completing an action.\n```\n\n---\n\n## 5. Git Operations Protocol (GAP-PROMPT-012)\n\n**File**: `packages/sdk/src/prompts/templates/git-safety.md`\n**Inject when**: Task involves code changes or version control operations\n\n```markdown\n## Git Operations Protocol\n\nWhen making git commits:\n\n1. Run `git status`, `git diff`, and `git log` to understand current state\n2. Analyze changes and draft a concise commit message (1-2 sentences, focus on\n   \"why\" not \"what\")\n3. Stage specific files by name (do NOT use `git add -A` or `git add .` which can\n   include sensitive files)\n4. Create the commit\n5. If pre-commit hooks fail: fix the issue and create a NEW commit\n\n**Rules**:\n- NEVER update git config\n- NEVER run destructive git commands (`push --force`, `reset --hard`,\n  `checkout .`, `clean -f`) unless explicitly asked\n- NEVER skip hooks (`--no-verify`, `--no-gpg-sign`) unless explicitly asked\n- NEVER amend commits unless explicitly asked -- always create NEW commits\n- NEVER commit files that likely contain secrets (`.env`, `credentials.json`)\n- Do NOT push to remote unless explicitly asked\n```\n\n---\n\n## 6. Compaction Protocol (GAP-PERF-002)\n\n**File**: `packages/sdk/src/prompts/templates/compaction-protocol.md`\n**Inject when**: Long-running orchestration sessions that need context compression\n\n```markdown\n## Compaction Protocol\n\nWhen summarizing a long conversation for context compression, produce a structured\nsummary with these mandatory sections:\n\n1. **Primary Request and Intent**: What was asked and why\n2. **Key Technical Concepts**: Domain knowledge established\n3. **Files and Code Sections**: Important files with paths, line numbers, and why\n   they matter. Include brief code snippets for modified sections.\n4. **Errors and Fixes**: What went wrong and how it was resolved (or not)\n5. **Problem Solving**: Approaches tried, what worked, what was abandoned and why\n6. **All User Messages**: Non-tool-result user messages, verbatim or near-verbatim\n7. **Pending Tasks**: What remains to be done\n8. **Current Work**: Precise description of where things stand right now\n9. **Optional Next Step**: The immediate next action with specifics\n\nWrite the summary as plain text. Do NOT call any tools during summarization.\nThe summary must contain enough detail that a fresh agent can pick up the work\nwithout re-reading files.\n```\n\n---\n\n## 7. Environment Context (GAP-PROMPT-003)\n\n**File**: `packages/sdk/src/prompts/templates/environment-context.md`\n**Inject when**: All agent tasks (stable stratum)\n\n```markdown\n## Environment\n\n{{#platform}}\n- Platform: {{platform}}\n{{/platform}}\n{{#shell}}\n- Shell: {{shell}}{{#isWindows}} (use Unix shell syntax, not Windows -- forward slashes, /dev/null not NUL){{/isWindows}}\n{{/shell}}\n{{#workingDirectory}}\n- Working directory: {{workingDirectory}}\n{{/workingDirectory}}\n{{#isGitRepo}}\n- Git repository: yes\n{{#gitBranch}}\n- Branch: {{gitBranch}}\n{{/gitBranch}}\n{{/isGitRepo}}\n{{#model}}\n- Model: {{model}}\n{{/model}}\n- Current date: {{currentDate}}\n```\n\n---\n\n## 8. Read-Before-Edit Enforcement\n\n**Where**: Add to agentic tool descriptions in `packages/sdk/src/harness/agenticTools.ts`\n\nFor the file-edit tool description, append:\n```\nYou MUST use the file-read tool at least once before editing a file.\nThis tool will error if you attempt an edit without reading the file first.\n```\n\nFor the file-write tool description, append:\n```\nIf modifying an existing file, you MUST use the file-read tool first to read\nthe file's contents. Prefer the file-edit tool for modifying existing files --\nit only sends the diff.\n```\n\n---\n\n## 9. Agent Briefing Style\n\n**Where**: Add to the agent/subagent tool description in agentic tools\n\n```\nWhen launching a subagent, brief it like a smart colleague who just walked into\nthe room. It has not seen this conversation, does not know what you have tried,\nand does not understand why this task matters.\n\nInclude:\n- What you are trying to accomplish and why\n- What you have already learned or ruled out\n- Enough context for the agent to make judgment calls\n\nNever delegate understanding. Do not write \"based on your findings, fix the bug\"\n-- include file paths, line numbers, what specifically to change.\n```\n\n---\n\n## 10. Memory/Knowledge Extraction Taxonomy\n\n**Where**: New prompt section for retrospect/cleanup tasks\n\n```markdown\n## Knowledge Extraction\n\nWhen extracting insights from completed runs, categorize them:\n\n1. **User**: Role, goals, preferences, knowledge -- how to tailor future behavior\n2. **Feedback**: Corrections AND confirmations -- what to avoid and what worked.\n   Include WHY (the reason) so edge cases can be judged later.\n3. **Project**: Ongoing work context, who is doing what, why, by when. Convert\n   relative dates to absolute dates.\n4. **Reference**: Pointers to external systems (Linear projects, Grafana boards,\n   Slack channels) and their purpose.\n\nDo NOT extract:\n- Code patterns derivable by reading current files\n- Git history (use `git log`)\n- Debugging solutions (the fix is in the code)\n- Ephemeral task details only useful in the current conversation\n```\n\n---\n\n## Implementation Plan\n\n### Phase 1 (Small effort, High impact)\n\n| Template | File to create | Render function | Add to composer |\n|----------|---------------|-----------------|-----------------|\n| coding-philosophy.md | `templates/coding-philosophy.md` | `parts/codingPhilosophy.ts` | `composeBabysitSkillPrompt` (for delegated tasks) |\n| tool-preferences.md | `templates/tool-preferences.md` | `parts/toolPreferences.ts` | `composeBabysitSkillPrompt` (for agentic tasks) |\n| safety-guidelines.md | `templates/safety-guidelines.md` | `parts/safetyGuidelines.ts` | ALL composers |\n| output-efficiency.md | `templates/output-efficiency.md` | `parts/outputEfficiency.ts` | ALL composers |\n| git-safety.md | `templates/git-safety.md` | `parts/gitSafety.ts` | `composeBabysitSkillPrompt` (for code tasks) |\n\n**Also**: Update agentic tool descriptions in `harness/agenticTools.ts` with read-before-edit\nenforcement and agent briefing style (items 8 and 9 above).\n\n### Phase 2 (Medium effort)\n\n| Template | File | Notes |\n|----------|------|-------|\n| compaction-protocol.md | `templates/compaction-protocol.md` | For session compaction |\n| environment-context.md | `templates/environment-context.md` | Needs template variables for platform/shell/git |\n| knowledge-extraction | (inline in retrospect prompt) | For harness:retrospect |\n\n### Integration into `compose.ts`\n\n```typescript\n// Add to composeBabysitSkillPrompt:\nexport function composeBabysitSkillPrompt(ctx: PromptContext): string {\n  return joinNonEmpty([\n    header + nonHookCaveatIntro,\n    parts.renderNonNegotiables(ctx),\n    parts.renderDependencies(ctx),\n    // ... existing sections ...\n    parts.renderCriticalRules(ctx),\n    // === NEW SECTIONS ===\n    parts.renderCodingPhilosophy(ctx),    // Only for code-writing tasks\n    parts.renderToolPreferences(ctx),      // Only when agentic tools available\n    parts.renderSafetyGuidelines(ctx),     // Always\n    parts.renderOutputEfficiency(ctx),     // Always\n    parts.renderGitSafety(ctx),           // Only for code tasks\n    parts.renderEnvironmentContext(ctx),   // Always\n    // === END NEW SECTIONS ===\n    parts.renderSeeAlso(ctx),\n    parts.renderProjectInstructions(ctx),\n  ]);\n}\n```\n\n### PromptContext additions needed\n\n```typescript\n// Add to types.ts:\ninterface PromptContext {\n  // ... existing fields ...\n\n  // New fields for environment context\n  workingDirectory?: string;\n  shell?: string;\n  isWindows?: boolean;\n  isGitRepo?: boolean;\n  gitBranch?: string;\n  model?: string;\n  currentDate?: string;\n\n  // New fields for conditional injection\n  taskInvolvesCode?: boolean;     // Inject coding-philosophy + git-safety\n  hasAgenticTools?: boolean;      // Inject tool-preferences\n}\n```\n",
    "documents": []
  },
  "outgoingEdges": [],
  "incomingEdges": [
    {
      "from": "page:docs-harness-features-backlog",
      "to": "page:docs-harness-features-backlog-gaps-prompt-engineering-prompt-phrasing-implementation",
      "kind": "contains_page"
    }
  ]
}

Shortcuts

Back to overview
Open graph tab