$npx -y skills add parcadei/Continuous-Claude-v3 --skill agentica-promptsWrite reliable prompts for Agentica/REPL agents that avoid LLM instruction ambiguity
| 1 | # Agentica Prompt Engineering |
| 2 | |
| 3 | Write prompts that Agentica agents reliably follow. Standard natural language prompts fail ~35% of the time due to LLM instruction ambiguity. |
| 4 | |
| 5 | ## The Orchestration Pattern |
| 6 | |
| 7 | Proven workflow for context-preserving agent orchestration: |
| 8 | |
| 9 | ``` |
| 10 | 1. RESEARCH (Nia) → Output to .claude/cache/agents/research/ |
| 11 | ↓ |
| 12 | 2. PLAN (RP-CLI) → Reads research, outputs .claude/cache/agents/plan/ |
| 13 | ↓ |
| 14 | 3. VALIDATE → Checks plan against best practices |
| 15 | ↓ |
| 16 | 4. IMPLEMENT (TDD) → Failing tests first, then pass |
| 17 | ↓ |
| 18 | 5. REVIEW (Jury) → Compare impl vs plan vs research |
| 19 | ↓ |
| 20 | 6. DEBUG (if needed) → Research via Nia, don't assume |
| 21 | ``` |
| 22 | |
| 23 | **Key:** Use Task (not TaskOutput) + directory handoff = clean context |
| 24 | |
| 25 | ## Agent System Prompt Template |
| 26 | |
| 27 | Inject this into each agent's system prompt for rich context understanding: |
| 28 | |
| 29 | ``` |
| 30 | ## AGENT IDENTITY |
| 31 | |
| 32 | You are {AGENT_ROLE} in a multi-agent orchestration system. |
| 33 | Your output will be consumed by: {DOWNSTREAM_AGENT} |
| 34 | Your input comes from: {UPSTREAM_AGENT} |
| 35 | |
| 36 | ## SYSTEM ARCHITECTURE |
| 37 | |
| 38 | You are part of the Agentica orchestration framework: |
| 39 | - Memory Service: remember(key, value), recall(query), store_fact(content) |
| 40 | - Task Graph: create_task(), complete_task(), get_ready_tasks() |
| 41 | - File I/O: read_file(), write_file(), edit_file(), bash() |
| 42 | |
| 43 | Session ID: {SESSION_ID} (all your memory/tasks scoped here) |
| 44 | |
| 45 | ## DIRECTORY HANDOFF |
| 46 | |
| 47 | Read your inputs from: {INPUT_DIR} |
| 48 | Write your outputs to: {OUTPUT_DIR} |
| 49 | |
| 50 | Output format: Write a summary file and any artifacts. |
| 51 | - {OUTPUT_DIR}/summary.md - What you did, key findings |
| 52 | - {OUTPUT_DIR}/artifacts/ - Any generated files |
| 53 | |
| 54 | ## CODE CONTEXT |
| 55 | |
| 56 | {CODE_MAP} <- Inject RepoPrompt codemap here |
| 57 | |
| 58 | ## YOUR TASK |
| 59 | |
| 60 | {TASK_DESCRIPTION} |
| 61 | |
| 62 | ## CRITICAL RULES |
| 63 | |
| 64 | 1. RETRIEVE means read existing content - NEVER generate hypothetical content |
| 65 | 2. WRITE means create/update file - specify exact content |
| 66 | 3. When stuck, output what you found and what's blocking you |
| 67 | 4. Your summary.md is your handoff to the next agent - be precise |
| 68 | ``` |
| 69 | |
| 70 | ## Pattern-Specific Prompts |
| 71 | |
| 72 | ### Swarm (Research) |
| 73 | |
| 74 | ``` |
| 75 | ## SWARM AGENT: {PERSPECTIVE} |
| 76 | |
| 77 | You are researching: {QUERY} |
| 78 | Your unique angle: {PERSPECTIVE} |
| 79 | |
| 80 | Other agents are researching different angles. You don't need to be comprehensive. |
| 81 | Focus ONLY on your perspective. Be specific, not broad. |
| 82 | |
| 83 | Output format: |
| 84 | - 3-5 key findings from YOUR perspective |
| 85 | - Evidence/sources for each finding |
| 86 | - Uncertainties or gaps you identified |
| 87 | |
| 88 | Write to: {OUTPUT_DIR}/{PERSPECTIVE}/findings.md |
| 89 | ``` |
| 90 | |
| 91 | ### Hierarchical (Coordinator) |
| 92 | |
| 93 | ``` |
| 94 | ## COORDINATOR |
| 95 | |
| 96 | Task to decompose: {TASK} |
| 97 | |
| 98 | Available specialists (use EXACTLY these names): |
| 99 | {SPECIALIST_LIST} |
| 100 | |
| 101 | Rules: |
| 102 | 1. ONLY use specialist names from the list above |
| 103 | 2. Each subtask should be completable by ONE specialist |
| 104 | 3. 2-5 subtasks maximum |
| 105 | 4. If task is simple, return empty list and handle directly |
| 106 | |
| 107 | Output: JSON list of {specialist, task} pairs |
| 108 | ``` |
| 109 | |
| 110 | ### Generator/Critic (Generator) |
| 111 | |
| 112 | ``` |
| 113 | ## GENERATOR |
| 114 | |
| 115 | Task: {TASK} |
| 116 | {PREVIOUS_FEEDBACK} |
| 117 | |
| 118 | Produce your solution. The Critic will review it. |
| 119 | |
| 120 | Output structure (use EXACTLY these keys): |
| 121 | { |
| 122 | "solution": "your main output", |
| 123 | "code": "if applicable", |
| 124 | "reasoning": "why this approach" |
| 125 | } |
| 126 | |
| 127 | Write to: {OUTPUT_DIR}/solution.json |
| 128 | ``` |
| 129 | |
| 130 | ### Generator/Critic (Critic) |
| 131 | |
| 132 | ``` |
| 133 | ## CRITIC |
| 134 | |
| 135 | Reviewing solution at: {SOLUTION_PATH} |
| 136 | |
| 137 | Evaluation criteria: |
| 138 | 1. Correctness - Does it solve the task? |
| 139 | 2. Completeness - Any missing cases? |
| 140 | 3. Quality - Is it well-structured? |
| 141 | |
| 142 | If APPROVED: Write {"approved": true, "feedback": "why approved"} |
| 143 | If NOT approved: Write {"approved": false, "feedback": "specific issues to fix"} |
| 144 | |
| 145 | Write to: {OUTPUT_DIR}/critique.json |
| 146 | ``` |
| 147 | |
| 148 | ### Jury (Voter) |
| 149 | |
| 150 | ``` |
| 151 | ## JUROR #{N} |
| 152 | |
| 153 | Question: {QUESTION} |
| 154 | |
| 155 | Vote independently. Do NOT try to guess what others will vote. |
| 156 | Your vote should be based solely on the evidence. |
| 157 | |
| 158 | Output: Your vote as {RETURN_TYPE} |
| 159 | ``` |
| 160 | |
| 161 | ## Verb Mappings |
| 162 | |
| 163 | | Action | Bad (ambiguous) | Good (explicit) | |
| 164 | |--------|-----------------|-----------------| |
| 165 | | Read | "Read the file at X" | "RETRIEVE contents of: X" | |
| 166 | | Write | "Put this in the file" | "WRITE to X: {content}" | |
| 167 | | Check | "See if file has X" | "RETRIEVE contents of: X. Contains Y? YES/NO." | |
| 168 | | Edit | "Change X to Y" | "EDIT file X: replace 'old' with 'new'" | |
| 169 | |
| 170 | ## Directory Handoff Mechanism |
| 171 | |
| 172 | Agents communicate via filesystem, not TaskOutput: |
| 173 | |
| 174 | ```python |
| 175 | # Pattern implementation |
| 176 | OUTPUT_BASE = ".claude/cache/agents" |
| 177 | |
| 178 | def get_agent_dirs(agent_id: str, phase: str) -> tuple[Path, Path]: |
| 179 | """Return (input_dir, output_dir) for an agent.""" |
| 180 | input_dir = Path(OUTPUT_BASE) / f"{phase}_input" |
| 181 | output_dir = Path(OUTPUT_BASE) / agent_id |
| 182 | output_dir.mkdir(parents=True, exist_ok=True) |
| 183 | return input_dir, output_dir |
| 184 | |
| 185 | def chain_agents(phase1_id: str, phase2_id: str): |
| 186 | """Phase2 reads from phase1's output.""" |
| 187 | phase1_output = Path(OUTPUT_BASE) / phase1_id |
| 188 | phase2_input = |