mapify-cli 1.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,454 @@
1
+ ---
2
+ description: Implement new feature using full MAP workflow
3
+ ---
4
+
5
+ # MAP Feature Implementation Workflow
6
+
7
+ **CRITICAL INSTRUCTION:** This is an **automated sequential workflow**. You MUST execute ALL steps from start to finish without stopping. After calling each subagent, IMMEDIATELY proceed to the next step in the workflow. DO NOT wait for user input between steps - this is a fully autonomous multi-agent orchestration.
8
+
9
+ **🚨 ABSOLUTELY FORBIDDEN 🚨**
10
+
11
+ You are **STRICTLY PROHIBITED** from:
12
+
13
+ ❌ **"Optimizing" the workflow due to token limits** - Token constraints are NOT a valid reason to skip agents
14
+ ❌ **"Combining steps to save time"** - Each agent MUST be called individually
15
+ ❌ **"Doing Reflector/Curator work manually"** - This breaks cipher integration
16
+ ❌ **"Creating a comprehensive document instead"** - This is NOT the MAP workflow
17
+ ❌ **"Skipping reflection for simple tasks"** - EVERY subtask requires Reflector + Curator
18
+ ❌ **Any variation of "I'll optimize by..."** - NO OPTIMIZATION ALLOWED
19
+
20
+ **IF YOU VIOLATE THESE RULES:**
21
+ - cipher_memory_search won't be called → duplicate knowledge
22
+ - cipher_extract_and_operate_memory won't be called → knowledge won't be shared
23
+ - The ENTIRE PURPOSE of MAP Framework will be defeated
24
+
25
+ **YOU MUST:**
26
+ ✅ Call EVERY agent in sequence for EVERY subtask
27
+ ✅ Verify each agent used required MCP tools (check output)
28
+ ✅ Complete the FULL workflow even if it takes 100K+ tokens
29
+ ✅ Ask user to continue if you hit token limit, but NEVER skip agents
30
+
31
+ Implement the following feature using the MAP (Modular Agentic Planner) framework with ACE (Adaptive Contextual Engine) learning:
32
+
33
+ **Feature Request:** $ARGUMENTS
34
+
35
+ ## Workflow Overview
36
+
37
+ You will orchestrate the MAP workflow by sequentially calling subagents using the Task tool. Follow this pattern:
38
+
39
+ ```
40
+ 1. DECOMPOSE → task-decomposer
41
+ 2. FOR each subtask:
42
+ 3. IMPLEMENT → actor
43
+ 4. VALIDATE → monitor
44
+ 5. If invalid: provide feedback to actor, go to step 3 (max 3-5 iterations)
45
+ 6. PREDICT → predictor
46
+ 7. EVALUATE → evaluator
47
+ 8. If not approved: provide feedback to actor, go to step 3
48
+ 9. ACCEPT and apply changes
49
+ 10. REFLECT → reflector (extract lessons)
50
+ 11. CURATE → curator (update playbook)
51
+ ```
52
+
53
+ **⚠️ IMPORTANT:** After each Task() call completes, immediately proceed to the next step. The workflow is SEQUENTIAL and AUTOMATED - do not stop after Actor, Monitor, Predictor, or Evaluator. Each step builds on the previous one. Continue until all subtasks are completed and reflected in the playbook.
54
+
55
+ ## Step 1: Load Playbook Context
56
+
57
+ Before starting, read `.claude/playbook.json` to get existing knowledge.
58
+
59
+ ## Step 2: Task Decomposition
60
+
61
+ Call the task-decomposer subagent to break down the feature into atomic subtasks:
62
+
63
+ ```
64
+ Task(
65
+ subagent_type="task-decomposer",
66
+ description="Decompose feature into subtasks",
67
+ prompt="Break down this feature into atomic subtasks (≤8):
68
+
69
+ Feature: $ARGUMENTS
70
+
71
+ Output JSON with:
72
+ - subtasks: array of {id, description, acceptance_criteria, estimated_complexity, depends_on}
73
+ - total_subtasks: number
74
+ - estimated_duration: string
75
+
76
+ Each subtask must be:
77
+ - Atomic (can't be subdivided further)
78
+ - Testable (clear acceptance criteria)
79
+ - Independent where possible (minimal dependencies)"
80
+ )
81
+ ```
82
+
83
+ ## Step 2.5: Create Recitation Plan (Context Engineering)
84
+
85
+ **IMPORTANT:** Create a task plan to keep goals fresh in context (Recitation pattern).
86
+
87
+ After receiving TaskDecomposer output, create the plan using Bash:
88
+
89
+ ```bash
90
+ # Save subtasks to temporary variable
91
+ SUBTASKS_JSON='[TaskDecomposer output JSON array]'
92
+ TASK_ID="feat_$(date +%s)"
93
+
94
+ # Create recitation plan
95
+ mapify recitation create "$TASK_ID" "$ARGUMENTS" "$SUBTASKS_JSON"
96
+ ```
97
+
98
+ This creates `.map/current_plan.md` which will be updated before each subtask to maintain focus.
99
+
100
+ **Example:**
101
+ ```bash
102
+ mapify recitation create feat_1760783000 "Add user authentication" '[{"id":1,"description":"Create User model",...}]'
103
+ ```
104
+
105
+ ## Step 3: For Each Subtask - Implementation Loop
106
+
107
+ For each subtask from task-decomposer output:
108
+
109
+ ### 3.1 Get Relevant Playbook Bullets
110
+
111
+ Search `.claude/playbook.json` for relevant patterns related to the current subtask (use grep/read).
112
+
113
+ ### 3.1.5 Update Recitation Plan (BEFORE Actor)
114
+
115
+ **Mark subtask as in_progress and get fresh context:**
116
+
117
+ ```bash
118
+ # Update plan status (subtask_id from TaskDecomposer)
119
+ mapify recitation update <subtask_id> in_progress
120
+
121
+ # Get current plan for Actor context (RECITATION PATTERN)
122
+ PLAN_CONTEXT=$(mapify recitation get-context)
123
+ # This markdown shows progress and current focus
124
+ ```
125
+
126
+ The `PLAN_CONTEXT` will be included in the Actor prompt below.
127
+
128
+ ### 3.2 Call Actor to Implement
129
+
130
+ **IMPORTANT:** Include plan context from step 3.1.5 in Actor prompt to maintain focus.
131
+
132
+ The Actor agent template (`.claude/agents/actor.md`) already has a `{{plan_context}}` template variable in the `<recitation_plan>` section. You just need to pass it:
133
+
134
+ ```
135
+ Task(
136
+ subagent_type="actor",
137
+ description="Implement subtask [ID]",
138
+ prompt="Implement this subtask:
139
+
140
+ **Subtask:** [description]
141
+ **Acceptance Criteria:** [criteria]
142
+
143
+ **Relevant Playbook Context:**
144
+ [Include 3-5 relevant bullets from playbook]
145
+
146
+ **Plan Context (for recitation):**
147
+ ```
148
+ [Insert output from: mapify recitation get-context]
149
+ ```
150
+
151
+ Output JSON with:
152
+ - approach: string (implementation strategy)
153
+ - code_changes: array of {file_path, change_type, content, rationale}
154
+ - trade_offs: array of strings
155
+ - testing_approach: string
156
+ - used_bullets: array of bullet IDs that were helpful
157
+
158
+ Provide FULL file content for each change, not diffs."
159
+ )
160
+ ```
161
+
162
+ **Note:** The Actor template will automatically format the plan_context in its `<recitation_plan>` section.
163
+
164
+ ### 3.3 Call Monitor to Validate
165
+
166
+ ```
167
+ Task(
168
+ subagent_type="monitor",
169
+ description="Validate actor proposal",
170
+ prompt="Review this implementation proposal:
171
+
172
+ **Actor Output:** [paste actor JSON]
173
+
174
+ Check for:
175
+ - Code correctness
176
+ - Security issues
177
+ - Performance concerns
178
+ - Test coverage
179
+ - Documentation
180
+ - Standards compliance
181
+
182
+ Output JSON with:
183
+ - valid: boolean
184
+ - issues: array of {severity, category, description, file_path, line_range}
185
+ - verdict: 'approved' | 'needs_revision' | 'rejected'
186
+ - feedback: string (actionable guidance)"
187
+ )
188
+ ```
189
+
190
+ ### 3.4 Decision Point
191
+
192
+ **If monitor.valid === false:**
193
+ - **Record error in plan (Recitation):**
194
+ ```bash
195
+ # Update with error message for retry
196
+ mapify recitation update <subtask_id> in_progress "Monitor feedback: [error details]"
197
+ # Plan will show: "⚠️ Retry attempt 2 - review previous errors"
198
+ ```
199
+ - Provide monitor feedback to actor
200
+ - Go back to step 3.1.5 (Actor implements fixes)
201
+ - **⚠️ CRITICAL:** After Actor applies fixes, IMMEDIATELY call Monitor again (step 3.3) to validate the corrections
202
+ - **DO NOT skip Monitor validation** - you cannot proceed to Predictor/Evaluator without Monitor approval
203
+ - Max 3-5 iterations, then escalate to user
204
+
205
+ **If monitor.valid === true:**
206
+ - Continue to step 3.5
207
+
208
+ ### 3.5 Call Predictor to Analyze Impact
209
+
210
+ **⚠️ PREREQUISITE:** You can ONLY reach this step if Monitor returned `valid: true` and `verdict: "approved"`. If you just applied Actor fixes after Monitor feedback, you MUST call Monitor again (step 3.3) before proceeding to Predictor.
211
+
212
+ ```
213
+ Task(
214
+ subagent_type="predictor",
215
+ description="Analyze implementation impact",
216
+ prompt="Analyze the impact of this implementation:
217
+
218
+ **Actor Output:** [paste actor JSON]
219
+ **Monitor Verdict:** approved
220
+
221
+ Analyze:
222
+ - Affected files and modules
223
+ - Breaking changes (API, schema, behavior)
224
+ - Dependencies that need updates
225
+ - Migration requirements
226
+ - Rollback strategy
227
+
228
+ Output JSON with:
229
+ - affected_files: array of {path, change_type, impact_level}
230
+ - breaking_changes: array of {type, description, mitigation}
231
+ - required_updates: array of strings
232
+ - risk_level: 'low' | 'medium' | 'high'
233
+ - rollback_plan: string"
234
+ )
235
+ ```
236
+
237
+ ### 3.6 Call Evaluator to Score Quality
238
+
239
+ ```
240
+ Task(
241
+ subagent_type="evaluator",
242
+ description="Evaluate solution quality",
243
+ prompt="Evaluate this solution:
244
+
245
+ **Actor Output:** [paste actor JSON]
246
+ **Monitor Verdict:** [verdict]
247
+ **Predictor Analysis:** [paste predictor JSON]
248
+
249
+ Score (0-10) on:
250
+ - code_quality
251
+ - test_coverage
252
+ - documentation_quality
253
+ - security
254
+ - performance
255
+ - maintainability
256
+
257
+ Output JSON with:
258
+ - scores: object with above metrics
259
+ - overall_score: number (average)
260
+ - recommendation: 'proceed' | 'improve' | 'reject'
261
+ - justification: string
262
+ - improvement_suggestions: array of strings"
263
+ )
264
+ ```
265
+
266
+ ### 3.7 Decision Point
267
+
268
+ **If evaluator.recommendation !== 'proceed':**
269
+ - Provide evaluator feedback to actor
270
+ - Go back to step 3.2
271
+
272
+ **If evaluator.recommendation === 'proceed':**
273
+ - ACCEPT the solution
274
+ - Apply code changes (use Write/Edit tools)
275
+ - **Mark subtask as completed (Recitation):**
276
+ ```bash
277
+ mapify recitation update <subtask_id> completed
278
+ # Plan will show: "✓ Subtask N completed"
279
+ # Next subtask will see this progress
280
+ ```
281
+ - Continue to step 3.8
282
+
283
+ ### 3.8 Call Reflector to Extract Lessons
284
+
285
+ **⚠️ CRITICAL:** The Reflector agent template (`.claude/agents/reflector.md`) contains MANDATORY instructions to use MCP tools. You MUST verify the Reflector actually uses these tools by checking its output:
286
+
287
+ **REQUIRED MCP Tools:**
288
+ 1. **BEFORE analysis**: `cipher_memory_search` - Check for similar past patterns
289
+ 2. **FOR complex failures**: `sequential-thinking` - Deep root cause analysis
290
+
291
+ **Verification Checklist:**
292
+ - [ ] Did Reflector output show `cipher_memory_search` was called?
293
+ - [ ] Did Reflector check for duplicate patterns before suggesting new bullets?
294
+ - [ ] If no cipher search visible in output, the agent DID NOT follow its instructions
295
+
296
+ ```
297
+ Task(
298
+ subagent_type="reflector",
299
+ description="Extract lessons from implementation",
300
+ prompt="Extract structured lessons from this implementation:
301
+
302
+ **Actor Code:** [paste actor output]
303
+ **Monitor Results:** [paste monitor output]
304
+ **Predictor Analysis:** [paste predictor output]
305
+ **Evaluator Scores:** [paste evaluator output]
306
+ **Execution Outcome:** success
307
+
308
+ **MANDATORY FIRST STEP (per agent template):**
309
+ Before extracting patterns, you MUST:
310
+ 1. Call cipher_memory_search to check if similar patterns already exist
311
+ 2. Only suggest new bullets if pattern is genuinely novel
312
+ 3. Reference existing cipher patterns in your analysis
313
+
314
+ Analyze:
315
+ - What worked well?
316
+ - What patterns were effective?
317
+ - What could be improved?
318
+ - What should be remembered for future tasks?
319
+
320
+ Output JSON with:
321
+ - key_insight: string (one sentence takeaway)
322
+ - patterns_used: array of strings
323
+ - patterns_discovered: array of strings
324
+ - bullet_updates: array of {bullet_id, new_helpful_count, new_harmful_count, reason}
325
+ - suggested_new_bullets: array of {section, content, code_example, initial_score}"
326
+ )
327
+ ```
328
+
329
+ ### 3.9 Call Curator to Update Playbook
330
+
331
+ **⚠️ CRITICAL:** The Curator agent template (`.claude/agents/curator.md`) contains MANDATORY instructions to use MCP tools for deduplication and knowledge sharing.
332
+
333
+ **REQUIRED MCP Tools:**
334
+ 1. **BEFORE creating ADD operations**: `cipher_memory_search` - Check for cross-project duplicates
335
+ 2. **AFTER playbook update**: `cipher_extract_and_operate_memory` - Sync high-quality bullets (helpful_count >= 5)
336
+
337
+ **Verification Checklist:**
338
+ - [ ] Did Curator output show `cipher_memory_search` was called before adding bullets?
339
+ - [ ] Did Curator output show `sync_to_cipher` operations for high-quality bullets?
340
+ - [ ] If no cipher operations visible, the agent DID NOT follow its instructions
341
+
342
+ ```
343
+ Task(
344
+ subagent_type="curator",
345
+ description="Update playbook with learnings",
346
+ prompt="Integrate these learnings into the playbook:
347
+
348
+ **Current Playbook:** [read from .claude/playbook.json]
349
+ **Reflector Insights:** [paste reflector JSON]
350
+
351
+ **MANDATORY STEPS (per agent template):**
352
+ 1. BEFORE creating ADD operations: cipher_memory_search to check duplicates
353
+ 2. Create delta operations (ADD/UPDATE/DEPRECATE)
354
+ 3. AFTER applying operations: IF any bullet has helpful_count >= 5, MUST call cipher_extract_and_operate_memory to sync to cross-project knowledge base
355
+
356
+ Output JSON with:
357
+ - operations: array of {operation: 'ADD'|'UPDATE'|'DEPRECATE', section, bullet_id, content, reason}
358
+ - deduplication_check: array of {new_bullet, similar_existing_bullets, action}
359
+ - sync_to_cipher: array of {bullet_id, content, helpful_count} (REQUIRED if helpful_count >= 5)"
360
+ )
361
+ ```
362
+
363
+ ### 3.10 Apply Curator Operations
364
+
365
+ **⚠️ CRITICAL ENFORCEMENT:**
366
+
367
+ - Read `.claude/playbook.json`
368
+ - Apply curator operations (ADD/UPDATE/DEPRECATE bullets)
369
+ - Write updated playbook back to `.claude/playbook.json`
370
+ - **MANDATORY**: If Curator output contains `sync_to_cipher` array with ANY entries, you MUST call:
371
+ ```
372
+ mcp__cipher__cipher_extract_and_operate_memory(
373
+ interaction: [bullet content],
374
+ memoryMetadata: {"projectId": "map-framework", "source": "curator"}
375
+ )
376
+ ```
377
+ - **DO NOT skip cipher sync** - high-quality patterns (helpful_count >= 5) MUST be shared across projects
378
+
379
+ ### 3.11 Move to Next Subtask
380
+
381
+ Repeat steps 3.1-3.10 for each remaining subtask.
382
+
383
+ ## Step 4: Final Summary
384
+
385
+ After all subtasks completed:
386
+
387
+ 1. **Get final statistics from Recitation:**
388
+ ```bash
389
+ mapify recitation stats
390
+ # Shows: total_subtasks, completed, total_iterations, etc.
391
+ ```
392
+
393
+ 2. **Run tests** (if applicable)
394
+
395
+ 3. **Create commit** with descriptive message
396
+
397
+ 4. **Summarize results**:
398
+ - Features implemented
399
+ - Files changed
400
+ - New playbook bullets added
401
+ - Overall quality score
402
+ - **Include recitation stats** (from step 1):
403
+ - Total subtasks
404
+ - Iterations needed
405
+ - Average iterations per subtask
406
+ - Success rate
407
+
408
+ 5. **Store workflow pattern in cipher** for future reuse
409
+
410
+ 6. **Clean up recitation plan:**
411
+ ```bash
412
+ mapify recitation clear
413
+ # Removes .map/current_plan.md and .map/current_plan.json
414
+ ```
415
+
416
+ ## MCP Tools Available
417
+
418
+ Use these MCP tools throughout the workflow:
419
+
420
+ - `mcp__cipher__cipher_memory_search` - Search for similar past implementations
421
+ - `mcp__cipher__cipher_extract_and_operate_memory` - Store successful patterns
422
+ - `mcp__sequential-thinking__sequentialthinking` - Complex decision making
423
+ - `mcp__context7__resolve-library-id` + `get-library-docs` - Get current library docs
424
+ - `mcp__deepwiki__read_wiki_structure` - Learn from other repositories
425
+ - `mcp__claude-reviewer__request_review` - Request code review at the end
426
+
427
+ ## Critical Constraints
428
+
429
+ - **NEVER skip monitor validation** - always validate before proceeding
430
+ - **NEVER exceed 5 iterations** per subtask - escalate to user if stuck
431
+ - **ALWAYS apply code changes** after evaluator approves
432
+ - **ALWAYS run reflector + curator** after each subtask (learn continuously)
433
+ - **ALWAYS update playbook** with new learnings
434
+ - **Use Task tool** to call all subagents (NOT Bash or Python)
435
+
436
+ ## Example Invocation
437
+
438
+ User says: `/map-feature add user authentication with JWT`
439
+
440
+ You should:
441
+ 1. Read `.claude/playbook.json`
442
+ 2. Call Task(subagent_type="task-decomposer", ...) to get subtasks
443
+ 3. For each subtask:
444
+ - Task(subagent_type="actor", ...)
445
+ - Task(subagent_type="monitor", ...)
446
+ - If approved: Task(subagent_type="predictor", ...)
447
+ - Task(subagent_type="evaluator", ...)
448
+ - If proceed: apply changes
449
+ - Task(subagent_type="reflector", ...)
450
+ - Task(subagent_type="curator", ...)
451
+ - Update playbook
452
+ 4. Commit and summarize
453
+
454
+ Begin now with the feature request above.