mapify-cli 3.7.0__tar.gz → 3.8.0__tar.gz

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.
Files changed (93) hide show
  1. {mapify_cli-3.7.0 → mapify_cli-3.8.0}/PKG-INFO +10 -6
  2. {mapify_cli-3.7.0 → mapify_cli-3.8.0}/README.md +9 -5
  3. {mapify_cli-3.7.0 → mapify_cli-3.8.0}/pyproject.toml +1 -1
  4. {mapify_cli-3.7.0 → mapify_cli-3.8.0}/src/mapify_cli/__init__.py +1 -1
  5. {mapify_cli-3.7.0 → mapify_cli-3.8.0}/src/mapify_cli/delivery/file_copier.py +4 -11
  6. {mapify_cli-3.7.0 → mapify_cli-3.8.0}/src/mapify_cli/schemas.py +156 -0
  7. {mapify_cli-3.7.0 → mapify_cli-3.8.0}/src/mapify_cli/templates/commands/map-check.md +13 -0
  8. {mapify_cli-3.7.0 → mapify_cli-3.8.0}/src/mapify_cli/templates/commands/map-debug.md +13 -3
  9. {mapify_cli-3.7.0 → mapify_cli-3.8.0}/src/mapify_cli/templates/commands/map-efficient.md +18 -1
  10. {mapify_cli-3.7.0 → mapify_cli-3.8.0}/src/mapify_cli/templates/commands/map-plan.md +39 -0
  11. {mapify_cli-3.7.0 → mapify_cli-3.8.0}/src/mapify_cli/templates/commands/map-review.md +14 -1
  12. {mapify_cli-3.7.0 → mapify_cli-3.8.0}/src/mapify_cli/templates/commands/map-task.md +11 -2
  13. {mapify_cli-3.7.0 → mapify_cli-3.8.0}/src/mapify_cli/templates/commands/map-tdd.md +38 -8
  14. {mapify_cli-3.7.0 → mapify_cli-3.8.0}/src/mapify_cli/templates/map/scripts/map_orchestrator.py +206 -11
  15. mapify_cli-3.8.0/src/mapify_cli/templates/map/scripts/map_step_runner.py +2663 -0
  16. {mapify_cli-3.7.0 → mapify_cli-3.8.0}/src/mapify_cli/templates/skills/map-learn/SKILL.md +37 -5
  17. {mapify_cli-3.7.0 → mapify_cli-3.8.0}/src/mapify_cli/templates/skills/map-planning/SKILL.md +4 -6
  18. mapify_cli-3.7.0/src/mapify_cli/templates/commands/map-learn.md +0 -301
  19. mapify_cli-3.7.0/src/mapify_cli/templates/map/scripts/map_step_runner.py +0 -1326
  20. {mapify_cli-3.7.0 → mapify_cli-3.8.0}/.claude/skills/README.md +0 -0
  21. {mapify_cli-3.7.0 → mapify_cli-3.8.0}/.gitignore +0 -0
  22. {mapify_cli-3.7.0 → mapify_cli-3.8.0}/src/mapify_cli/cli_ui.py +0 -0
  23. {mapify_cli-3.7.0 → mapify_cli-3.8.0}/src/mapify_cli/config/__init__.py +0 -0
  24. {mapify_cli-3.7.0 → mapify_cli-3.8.0}/src/mapify_cli/config/mcp.py +0 -0
  25. {mapify_cli-3.7.0 → mapify_cli-3.8.0}/src/mapify_cli/config/project_config.py +0 -0
  26. {mapify_cli-3.7.0 → mapify_cli-3.8.0}/src/mapify_cli/config/settings.py +0 -0
  27. {mapify_cli-3.7.0 → mapify_cli-3.8.0}/src/mapify_cli/delivery/__init__.py +0 -0
  28. {mapify_cli-3.7.0 → mapify_cli-3.8.0}/src/mapify_cli/delivery/agent_generator.py +0 -0
  29. {mapify_cli-3.7.0 → mapify_cli-3.8.0}/src/mapify_cli/delivery/managed_file_copier.py +0 -0
  30. {mapify_cli-3.7.0 → mapify_cli-3.8.0}/src/mapify_cli/dependency_graph.py +0 -0
  31. {mapify_cli-3.7.0 → mapify_cli-3.8.0}/src/mapify_cli/intent_detector.py +0 -0
  32. {mapify_cli-3.7.0 → mapify_cli-3.8.0}/src/mapify_cli/ralph_state.py +0 -0
  33. {mapify_cli-3.7.0 → mapify_cli-3.8.0}/src/mapify_cli/repo_insight.py +0 -0
  34. {mapify_cli-3.7.0 → mapify_cli-3.8.0}/src/mapify_cli/templates/CLAUDE.md +0 -0
  35. {mapify_cli-3.7.0 → mapify_cli-3.8.0}/src/mapify_cli/templates/agents/actor.md +0 -0
  36. {mapify_cli-3.7.0 → mapify_cli-3.8.0}/src/mapify_cli/templates/agents/debate-arbiter.md +0 -0
  37. {mapify_cli-3.7.0 → mapify_cli-3.8.0}/src/mapify_cli/templates/agents/documentation-reviewer.md +0 -0
  38. {mapify_cli-3.7.0 → mapify_cli-3.8.0}/src/mapify_cli/templates/agents/evaluator.md +0 -0
  39. {mapify_cli-3.7.0 → mapify_cli-3.8.0}/src/mapify_cli/templates/agents/final-verifier.md +0 -0
  40. {mapify_cli-3.7.0 → mapify_cli-3.8.0}/src/mapify_cli/templates/agents/monitor.md +0 -0
  41. {mapify_cli-3.7.0 → mapify_cli-3.8.0}/src/mapify_cli/templates/agents/predictor.md +0 -0
  42. {mapify_cli-3.7.0 → mapify_cli-3.8.0}/src/mapify_cli/templates/agents/reflector.md +0 -0
  43. {mapify_cli-3.7.0 → mapify_cli-3.8.0}/src/mapify_cli/templates/agents/research-agent.md +0 -0
  44. {mapify_cli-3.7.0 → mapify_cli-3.8.0}/src/mapify_cli/templates/agents/synthesizer.md +0 -0
  45. {mapify_cli-3.7.0 → mapify_cli-3.8.0}/src/mapify_cli/templates/agents/task-decomposer.md +0 -0
  46. {mapify_cli-3.7.0 → mapify_cli-3.8.0}/src/mapify_cli/templates/commands/map-fast.md +0 -0
  47. {mapify_cli-3.7.0 → mapify_cli-3.8.0}/src/mapify_cli/templates/commands/map-release.md +0 -0
  48. {mapify_cli-3.7.0 → mapify_cli-3.8.0}/src/mapify_cli/templates/commands/map-resume.md +0 -0
  49. {mapify_cli-3.7.0 → mapify_cli-3.8.0}/src/mapify_cli/templates/hooks/end-of-turn.sh +0 -0
  50. {mapify_cli-3.7.0 → mapify_cli-3.8.0}/src/mapify_cli/templates/hooks/post-compact-context.py +0 -0
  51. {mapify_cli-3.7.0 → mapify_cli-3.8.0}/src/mapify_cli/templates/hooks/pre-compact-save-transcript.py +0 -0
  52. {mapify_cli-3.7.0 → mapify_cli-3.8.0}/src/mapify_cli/templates/hooks/ralph-context-pruner.py +0 -0
  53. {mapify_cli-3.7.0 → mapify_cli-3.8.0}/src/mapify_cli/templates/hooks/ralph-iteration-logger.py +0 -0
  54. {mapify_cli-3.7.0 → mapify_cli-3.8.0}/src/mapify_cli/templates/hooks/safety-guardrails.py +0 -0
  55. {mapify_cli-3.7.0 → mapify_cli-3.8.0}/src/mapify_cli/templates/hooks/workflow-context-injector.py +0 -0
  56. {mapify_cli-3.7.0 → mapify_cli-3.8.0}/src/mapify_cli/templates/hooks/workflow-gate.py +0 -0
  57. {mapify_cli-3.7.0 → mapify_cli-3.8.0}/src/mapify_cli/templates/map/scripts/diagnostics.py +0 -0
  58. {mapify_cli-3.7.0 → mapify_cli-3.8.0}/src/mapify_cli/templates/map/scripts/map_utils.py +0 -0
  59. {mapify_cli-3.7.0 → mapify_cli-3.8.0}/src/mapify_cli/templates/map/static-analysis/analyze.sh +0 -0
  60. {mapify_cli-3.7.0 → mapify_cli-3.8.0}/src/mapify_cli/templates/map/static-analysis/handlers/common.sh +0 -0
  61. {mapify_cli-3.7.0 → mapify_cli-3.8.0}/src/mapify_cli/templates/map/static-analysis/handlers/go.sh +0 -0
  62. {mapify_cli-3.7.0 → mapify_cli-3.8.0}/src/mapify_cli/templates/map/static-analysis/handlers/python.sh +0 -0
  63. {mapify_cli-3.7.0 → mapify_cli-3.8.0}/src/mapify_cli/templates/map/static-analysis/handlers/rust.sh +0 -0
  64. {mapify_cli-3.7.0 → mapify_cli-3.8.0}/src/mapify_cli/templates/map/static-analysis/handlers/typescript.sh +0 -0
  65. {mapify_cli-3.7.0 → mapify_cli-3.8.0}/src/mapify_cli/templates/ralph-loop-config.json +0 -0
  66. {mapify_cli-3.7.0 → mapify_cli-3.8.0}/src/mapify_cli/templates/references/bash-guidelines.md +0 -0
  67. {mapify_cli-3.7.0 → mapify_cli-3.8.0}/src/mapify_cli/templates/references/decomposition-examples.md +0 -0
  68. {mapify_cli-3.7.0 → mapify_cli-3.8.0}/src/mapify_cli/templates/references/escalation-matrix.md +0 -0
  69. {mapify_cli-3.7.0 → mapify_cli-3.8.0}/src/mapify_cli/templates/references/mcp-usage-examples.md +0 -0
  70. {mapify_cli-3.7.0 → mapify_cli-3.8.0}/src/mapify_cli/templates/references/step-state-schema.md +0 -0
  71. {mapify_cli-3.7.0 → mapify_cli-3.8.0}/src/mapify_cli/templates/references/workflow-state-schema.md +0 -0
  72. {mapify_cli-3.7.0 → mapify_cli-3.8.0}/src/mapify_cli/templates/rules/learned/README.md +0 -0
  73. {mapify_cli-3.7.0 → mapify_cli-3.8.0}/src/mapify_cli/templates/settings.json +0 -0
  74. {mapify_cli-3.7.0 → mapify_cli-3.8.0}/src/mapify_cli/templates/skills/README.md +0 -0
  75. {mapify_cli-3.7.0 → mapify_cli-3.8.0}/src/mapify_cli/templates/skills/map-learn/templates/example-rules.md +0 -0
  76. {mapify_cli-3.7.0 → mapify_cli-3.8.0}/src/mapify_cli/templates/skills/map-learn/templates/rules-unconditional.md +0 -0
  77. {mapify_cli-3.7.0 → mapify_cli-3.8.0}/src/mapify_cli/templates/skills/map-learn/templates/rules-with-paths.md +0 -0
  78. {mapify_cli-3.7.0 → mapify_cli-3.8.0}/src/mapify_cli/templates/skills/map-planning/scripts/check-complete.sh +0 -0
  79. {mapify_cli-3.7.0 → mapify_cli-3.8.0}/src/mapify_cli/templates/skills/map-planning/scripts/get-plan-path.sh +0 -0
  80. {mapify_cli-3.7.0 → mapify_cli-3.8.0}/src/mapify_cli/templates/skills/map-planning/scripts/init-session.sh +0 -0
  81. {mapify_cli-3.7.0 → mapify_cli-3.8.0}/src/mapify_cli/templates/skills/map-planning/scripts/show-focus.sh +0 -0
  82. {mapify_cli-3.7.0 → mapify_cli-3.8.0}/src/mapify_cli/templates/skills/map-planning/templates/findings.md +0 -0
  83. {mapify_cli-3.7.0 → mapify_cli-3.8.0}/src/mapify_cli/templates/skills/map-planning/templates/iteration_history.md +0 -0
  84. {mapify_cli-3.7.0 → mapify_cli-3.8.0}/src/mapify_cli/templates/skills/map-planning/templates/progress.md +0 -0
  85. {mapify_cli-3.7.0 → mapify_cli-3.8.0}/src/mapify_cli/templates/skills/map-planning/templates/task_plan.md +0 -0
  86. {mapify_cli-3.7.0 → mapify_cli-3.8.0}/src/mapify_cli/templates/skills/skill-rules.json +0 -0
  87. {mapify_cli-3.7.0 → mapify_cli-3.8.0}/src/mapify_cli/templates/workflow-rules.json +0 -0
  88. {mapify_cli-3.7.0 → mapify_cli-3.8.0}/src/mapify_cli/tools/__init__.py +0 -0
  89. {mapify_cli-3.7.0 → mapify_cli-3.8.0}/src/mapify_cli/tools/validate_dependencies.py +0 -0
  90. {mapify_cli-3.7.0 → mapify_cli-3.8.0}/src/mapify_cli/verification_recorder.py +0 -0
  91. {mapify_cli-3.7.0 → mapify_cli-3.8.0}/src/mapify_cli/workflow_finalizer.py +0 -0
  92. {mapify_cli-3.7.0 → mapify_cli-3.8.0}/src/mapify_cli/workflow_logger.py +0 -0
  93. {mapify_cli-3.7.0 → mapify_cli-3.8.0}/src/mapify_cli/workflow_state.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mapify-cli
3
- Version: 3.7.0
3
+ Version: 3.8.0
4
4
  Summary: MAP Framework installer - Modular Agentic Planner for Claude Code
5
5
  Project-URL: Homepage, https://github.com/azalio/map-framework
6
6
  Project-URL: Repository, https://github.com/azalio/map-framework.git
@@ -87,17 +87,21 @@ claude
87
87
  | `/map-tdd` | Test-first implementation workflow |
88
88
  | `/map-release` | Package release workflow |
89
89
  | `/map-resume` | Resume interrupted workflows |
90
- | `/map-learn` | Extract lessons after workflow completion |
90
+ | `/map-learn` | Extract lessons after workflow completion; optional `[workflow-summary]` |
91
91
 
92
92
  [Detailed usage and options →](docs/USAGE.md)
93
93
 
94
94
  Canonical MAP flows:
95
95
 
96
- - Standard: `/map-plan` -> `/map-efficient` -> `/map-check` -> `/map-review`
97
- - Full TDD: `/map-plan` -> `/map-tdd` -> `/map-check` -> `/map-review`
98
- - Targeted subtask TDD: `/map-plan` -> `/map-tdd ST-001` -> `/map-task ST-001` -> ... -> `/map-check` -> `/map-review`
96
+ - Standard: `/map-plan` -> `/map-efficient` -> `/map-check` -> `/map-review` -> `/map-learn` (when you want to pay the learning cost)
97
+ - Full TDD: `/map-plan` -> `/map-tdd` -> `/map-check` -> `/map-review` -> `/map-learn`
98
+ - Targeted subtask TDD: `/map-plan` -> `/map-tdd ST-001` -> `/map-task ST-001` -> ... -> `/map-check` -> `/map-review` -> `/map-learn`
99
99
 
100
- These workflows maintain branch-scoped artifacts like `code-review-001.md`, `qa-001.md`, `verification-summary.md`, `pr-draft.md`, and run dossiers under `.map/<branch>/`.
100
+ `/map-plan` now records a workflow-fit decision first, so trivial work can exit early with a direct edit or `/map-fast` recommendation instead of forcing full MAP planning.
101
+
102
+ These workflows maintain branch-scoped artifacts like `code-review-001.md`, `qa-001.md`, `verification-summary.md`, `pr-draft.md`, `artifact_manifest.json`, and run dossiers under `.map/<branch>/`. Targeted TDD flows also persist `test_contract_ST-00N.md` and `test_handoff_ST-00N.json` so `/map-task` can resume implementation from a clean red-phase handoff.
103
+
104
+ `LEARN` is still the philosophical end of the MAP cycle, but runtime keeps it soft: `/map-efficient`, `/map-debug`, `/map-check`, and `/map-review` now write `learning-handoff.md` / `.json` under `.map/<branch>/`, so `/map-learn [workflow-summary]` can run immediately with an explicit summary or later with no argument by auto-loading the generated handoff.
101
105
 
102
106
  ## How It Works
103
107
 
@@ -55,17 +55,21 @@ claude
55
55
  | `/map-tdd` | Test-first implementation workflow |
56
56
  | `/map-release` | Package release workflow |
57
57
  | `/map-resume` | Resume interrupted workflows |
58
- | `/map-learn` | Extract lessons after workflow completion |
58
+ | `/map-learn` | Extract lessons after workflow completion; optional `[workflow-summary]` |
59
59
 
60
60
  [Detailed usage and options →](docs/USAGE.md)
61
61
 
62
62
  Canonical MAP flows:
63
63
 
64
- - Standard: `/map-plan` -> `/map-efficient` -> `/map-check` -> `/map-review`
65
- - Full TDD: `/map-plan` -> `/map-tdd` -> `/map-check` -> `/map-review`
66
- - Targeted subtask TDD: `/map-plan` -> `/map-tdd ST-001` -> `/map-task ST-001` -> ... -> `/map-check` -> `/map-review`
64
+ - Standard: `/map-plan` -> `/map-efficient` -> `/map-check` -> `/map-review` -> `/map-learn` (when you want to pay the learning cost)
65
+ - Full TDD: `/map-plan` -> `/map-tdd` -> `/map-check` -> `/map-review` -> `/map-learn`
66
+ - Targeted subtask TDD: `/map-plan` -> `/map-tdd ST-001` -> `/map-task ST-001` -> ... -> `/map-check` -> `/map-review` -> `/map-learn`
67
67
 
68
- These workflows maintain branch-scoped artifacts like `code-review-001.md`, `qa-001.md`, `verification-summary.md`, `pr-draft.md`, and run dossiers under `.map/<branch>/`.
68
+ `/map-plan` now records a workflow-fit decision first, so trivial work can exit early with a direct edit or `/map-fast` recommendation instead of forcing full MAP planning.
69
+
70
+ These workflows maintain branch-scoped artifacts like `code-review-001.md`, `qa-001.md`, `verification-summary.md`, `pr-draft.md`, `artifact_manifest.json`, and run dossiers under `.map/<branch>/`. Targeted TDD flows also persist `test_contract_ST-00N.md` and `test_handoff_ST-00N.json` so `/map-task` can resume implementation from a clean red-phase handoff.
71
+
72
+ `LEARN` is still the philosophical end of the MAP cycle, but runtime keeps it soft: `/map-efficient`, `/map-debug`, `/map-check`, and `/map-review` now write `learning-handoff.md` / `.json` under `.map/<branch>/`, so `/map-learn [workflow-summary]` can run immediately with an explicit summary or later with no argument by auto-loading the generated handoff.
69
73
 
70
74
  ## How It Works
71
75
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "mapify-cli"
3
- version = "3.7.0"
3
+ version = "3.8.0"
4
4
  description = "MAP Framework installer - Modular Agentic Planner for Claude Code"
5
5
  authors = [{ name = "MAP Framework Contributors" }]
6
6
  readme = "README.md"
@@ -23,7 +23,7 @@ Or install globally:
23
23
  mapify check
24
24
  """
25
25
 
26
- __version__ = "3.7.0"
26
+ __version__ = "3.8.0"
27
27
 
28
28
  import os
29
29
  import subprocess
@@ -184,16 +184,6 @@ $ARGUMENTS
184
184
 
185
185
  Implement quickly with basic monitor validation only. No learning, no predictor.
186
186
  Use for small, low-risk changes where speed matters.
187
- """,
188
- "map-learn": """---
189
- description: Extract lessons from completed workflows
190
- ---
191
-
192
- Extract and preserve lessons from recent workflow:
193
-
194
- $ARGUMENTS
195
-
196
- Call Reflector to extract patterns from recent workflow.
197
187
  """,
198
188
  }
199
189
 
@@ -315,10 +305,13 @@ This directory contains custom slash commands for Claude Code.
315
305
  - `/map-review` - Run a structured review workflow
316
306
  - `/map-check` - Run workflow quality gates and verification
317
307
  - `/map-fast` - Quick implementation with minimal validation
318
- - `/map-learn` - Extract lessons from completed workflows
319
308
  - `/map-release` - Execute MAP Framework package release workflow
320
309
  - `/map-resume` - Resume an interrupted workflow from `.map/`
321
310
 
311
+ ## Skill-Backed Slash Surfaces
312
+
313
+ - `/map-learn` - Extract lessons from completed workflows (implemented via `.claude/skills/map-learn/SKILL.md`)
314
+
322
315
  ## Creating Custom Commands
323
316
 
324
317
  Create a new `.md` file in this directory with the following format:
@@ -464,3 +464,159 @@ REPO_INSIGHT_SCHEMA = {
464
464
  "required": ["language", "suggested_checks", "key_dirs"],
465
465
  "additionalProperties": True,
466
466
  }
467
+
468
+
469
+ WORKFLOW_FIT_DECISION_SCHEMA = {
470
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
471
+ "$id": "https://mapframework.dev/schemas/workflow-fit-decision.json",
472
+ "title": "MAP Workflow Fit Decision",
473
+ "description": "Preflight workflow-fit decision stored in .map/<branch>/workflow-fit.json",
474
+ "type": "object",
475
+ "properties": {
476
+ "version": {"type": "string"},
477
+ "recommended_workflow": {
478
+ "type": "string",
479
+ "enum": [
480
+ "direct-edit",
481
+ "map-fast",
482
+ "map-efficient",
483
+ "map-tdd",
484
+ "map-plan",
485
+ ],
486
+ },
487
+ "needs_map": {"type": "boolean"},
488
+ "decision_summary": {"type": "string"},
489
+ "signals": {
490
+ "type": "object",
491
+ "properties": {
492
+ "expected_diff_size": {
493
+ "type": "string",
494
+ "enum": ["tiny", "small", "medium", "large"],
495
+ },
496
+ "has_new_invariants": {"type": "boolean"},
497
+ "needs_independent_review": {"type": "boolean"},
498
+ "has_clear_acceptance_criteria": {"type": "boolean"},
499
+ "test_first_required": {"type": "boolean"},
500
+ },
501
+ "required": [
502
+ "expected_diff_size",
503
+ "has_new_invariants",
504
+ "needs_independent_review",
505
+ "has_clear_acceptance_criteria",
506
+ "test_first_required",
507
+ ],
508
+ "additionalProperties": False,
509
+ },
510
+ "updated_at": {"type": "string", "format": "date-time"},
511
+ },
512
+ "required": [
513
+ "version",
514
+ "recommended_workflow",
515
+ "needs_map",
516
+ "decision_summary",
517
+ "signals",
518
+ "updated_at",
519
+ ],
520
+ "additionalProperties": False,
521
+ }
522
+
523
+
524
+ ARTIFACT_STAGE_SCHEMA = {
525
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
526
+ "$id": "https://mapframework.dev/schemas/artifact-stage.json",
527
+ "title": "MAP Artifact Stage",
528
+ "description": "One stage entry inside artifact_manifest.json",
529
+ "type": "object",
530
+ "properties": {
531
+ "status": {"type": "string"},
532
+ "updated_at": {"type": "string", "format": "date-time"},
533
+ "artifacts": {
534
+ "type": "array",
535
+ "items": {
536
+ "type": "object",
537
+ "properties": {
538
+ "path": {"type": "string"},
539
+ "kind": {"type": "string"},
540
+ },
541
+ "required": ["path", "kind"],
542
+ "additionalProperties": False,
543
+ },
544
+ },
545
+ "metadata": {"type": "object"},
546
+ },
547
+ "required": ["status", "updated_at", "artifacts", "metadata"],
548
+ "additionalProperties": False,
549
+ }
550
+
551
+
552
+ ARTIFACT_MANIFEST_SCHEMA = {
553
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
554
+ "$id": "https://mapframework.dev/schemas/artifact-manifest.json",
555
+ "title": "MAP Artifact Manifest",
556
+ "description": "Branch-scoped artifact manifest stored in .map/<branch>/artifact_manifest.json",
557
+ "type": "object",
558
+ "properties": {
559
+ "schema_version": {"type": "string"},
560
+ "branch": {"type": "string"},
561
+ "updated_at": {"type": "string", "format": "date-time"},
562
+ "stages": {
563
+ "type": "object",
564
+ "properties": {
565
+ "workflow_fit": ARTIFACT_STAGE_SCHEMA,
566
+ "spec": ARTIFACT_STAGE_SCHEMA,
567
+ "plan": ARTIFACT_STAGE_SCHEMA,
568
+ "test_contract": ARTIFACT_STAGE_SCHEMA,
569
+ "implementation": ARTIFACT_STAGE_SCHEMA,
570
+ "review": ARTIFACT_STAGE_SCHEMA,
571
+ "verification": ARTIFACT_STAGE_SCHEMA,
572
+ "learn_handoff": ARTIFACT_STAGE_SCHEMA,
573
+ },
574
+ "required": [
575
+ "workflow_fit",
576
+ "spec",
577
+ "plan",
578
+ "test_contract",
579
+ "implementation",
580
+ "review",
581
+ "verification",
582
+ "learn_handoff",
583
+ ],
584
+ "additionalProperties": False,
585
+ },
586
+ },
587
+ "required": ["schema_version", "branch", "updated_at", "stages"],
588
+ "additionalProperties": False,
589
+ }
590
+
591
+
592
+ TEST_HANDOFF_SCHEMA = {
593
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
594
+ "$id": "https://mapframework.dev/schemas/test-handoff.json",
595
+ "title": "MAP Test Handoff",
596
+ "description": "Persisted TDD handoff stored in .map/<branch>/test_handoff_<subtask>.json",
597
+ "type": "object",
598
+ "properties": {
599
+ "subtask_id": {"type": "string"},
600
+ "status": {"type": "string", "enum": ["contract_ready"]},
601
+ "contract_path": {"type": "string"},
602
+ "failing_test_command": {"type": ["string", "null"]},
603
+ "test_files": {
604
+ "type": "array",
605
+ "items": {"type": "string"},
606
+ },
607
+ "contract_summary": {"type": "string"},
608
+ "notes": {"type": "string"},
609
+ "updated_at": {"type": "string", "format": "date-time"},
610
+ },
611
+ "required": [
612
+ "subtask_id",
613
+ "status",
614
+ "contract_path",
615
+ "failing_test_command",
616
+ "test_files",
617
+ "contract_summary",
618
+ "notes",
619
+ "updated_at",
620
+ ],
621
+ "additionalProperties": False,
622
+ }
@@ -338,6 +338,19 @@ python3 .map/scripts/map_step_runner.py write_pr_draft "$SUMMARY" "$VALIDATION"
338
338
  This ensures `pr-draft.md` is built from actual workflow artifacts instead of freeform memory.
339
339
  It also means `/map-review` can consume a single consolidated verification handoff instead of re-deriving the branch state from scratch.
340
340
 
341
+ Then write the deferred learning handoff so the philosophical `LEARN` stage stays cheap at runtime:
342
+
343
+ ```bash
344
+ python3 .map/scripts/map_step_runner.py write_learning_handoff \
345
+ map-check \
346
+ "<task title>" \
347
+ "READY FOR REVIEW|NEEDS WORK" \
348
+ "<run /map-review next, or rework and rerun /map-check>" \
349
+ "<optional verification note>"
350
+ ```
351
+
352
+ This writes `.map/<branch>/learning-handoff.md` and `.json`, updates `artifact_manifest.json`, and lets `/map-learn` auto-load the workflow context later with no manual reconstruction.
353
+
341
354
  Recommended format:
342
355
 
343
356
  ```markdown
@@ -208,6 +208,18 @@ If evaluator recommends proceeding:
208
208
  - Apply code changes using Write/Edit tools
209
209
  - Run tests to verify fix
210
210
  - Check that original issue is resolved
211
+ - Write a deferred learning handoff so `/map-learn` can reuse the debug context later:
212
+
213
+ ```bash
214
+ python3 .map/scripts/map_step_runner.py write_learning_handoff \
215
+ map-debug \
216
+ "$ARGUMENTS" \
217
+ "Debugging workflow complete" \
218
+ "Ship the fix, or run /map-review if you want independent scrutiny" \
219
+ "<root cause + fix summary>"
220
+ ```
221
+
222
+ This writes `.map/<branch>/learning-handoff.md` and `.json`, updates `artifact_manifest.json`, and keeps post-debug learning cheap.
211
223
 
212
224
  ## Step 4: Verification
213
225
 
@@ -225,9 +237,7 @@ After all fixes applied:
225
237
  **If you want to save debugging patterns for future use:**
226
238
 
227
239
  ```
228
- /map-learn Debugged [issue description]. Root cause: [cause].
229
- Fix: [summary]. Prevention strategies: [list].
230
- Files changed: [files]. Iterations: [count].
240
+ /map-learn
231
241
  ```
232
242
 
233
243
  This is **completely optional**. Run it when debugging patterns are valuable for future reference.
@@ -77,6 +77,7 @@ Branch-scoped markdown artifacts in `.map/<branch>/`:
77
77
  Parse optional flags from `$ARGUMENTS`:
78
78
 
79
79
  - **`--tdd`**: Enable TDD mode (test-first workflow). Inserts TEST_WRITER and TEST_FAIL_GATE phases before ACTOR. Tests are written from spec before implementation.
80
+ - If you need a persisted clean-session handoff between tests and implementation, prefer `/map-tdd ST-001` and then resume with `/map-task ST-001`.
80
81
 
81
82
  ```bash
82
83
  # Extract flags and clean task description
@@ -419,6 +420,8 @@ pytest --tb=short 2>&1 || true
419
420
  # If tests FAIL with assertion errors → proceed to ACTOR (expected TDD state)
420
421
  ```
421
422
 
423
+ If you want to stop after the red phase and resume implementation in a clean session, persist `test_contract_<subtask>.md` + `test_handoff_<subtask>.json` via `/map-tdd ST-001`, then continue later with `/map-task ST-001`.
424
+
422
425
  ### Phase: ACTOR (2.3)
423
426
 
424
427
  When TDD mode is active, Actor receives `<TDD_Mode>code_only</TDD_Mode>` and must NOT modify test files. When TDD is off, standard behavior.
@@ -786,6 +789,19 @@ Also update `.map/<branch>/pr-draft.md` with:
786
789
 
787
790
  Update `.map/<branch>/pr-draft.md` with final summary and verification results.
788
791
 
792
+ Then write the deferred learning handoff so `LEARN` remains part of the philosophy without paying Reflector cost inline:
793
+
794
+ ```bash
795
+ python3 .map/scripts/map_step_runner.py write_learning_handoff \
796
+ map-efficient \
797
+ "<task title>" \
798
+ "READY FOR REVIEW" \
799
+ "Run /map-review next, or defer /map-learn until you want to preserve patterns" \
800
+ "<optional implementation note>"
801
+ ```
802
+
803
+ This writes `.map/<branch>/learning-handoff.md` and `.json`, updates `artifact_manifest.json`, and lets `/map-learn` auto-load the workflow context later.
804
+
789
805
  ### 3.3 Evaluate Results
790
806
 
791
807
  ```python
@@ -817,6 +833,7 @@ else:
817
833
 
818
834
  - Update Terminal State in task_plan: **Status:** complete
819
835
  - Report features implemented, files changed, verification confidence
820
- - **Optional:** Run `/map-learn [summary]` to preserve patterns
836
+ - `learning-handoff.md` / `.json` should already be written for deferred learning
837
+ - **Optional:** Run `/map-learn` now, or batch it later when the workflow is worth preserving
821
838
 
822
839
  Begin execution now.
@@ -8,10 +8,12 @@
8
8
  - Want to establish clear task boundaries before execution
9
9
 
10
10
  **What this command does:**
11
+ - Records a workflow-fit decision before planning so trivial work can exit early
11
12
  - Optionally runs a short discovery pass (research-agent) to identify key files/patterns
12
13
  - Calls task-decomposer agent to break down the user's request into subtasks
13
14
  - Creates `.map/<branch>/task_plan_<branch>.md` with subtask list
14
15
  - Initializes `.map/<branch>/step_state.json` with subtask sequence
16
+ - Updates `.map/<branch>/artifact_manifest.json` with the planning artifacts
15
17
  - **STOPS** after planning (forces context flush)
16
18
 
17
19
  **What this command CANNOT do:**
@@ -43,6 +45,35 @@ echo "state: $(test -f .map/${BRANCH}/step_state.json && echo EXISTS || ec
43
45
 
44
46
  This prevents redundant work when the user restarts Claude mid-plan.
45
47
 
48
+ ### Pre-flight: Workflow-Fit Gate
49
+
50
+ Before discovery or interview, decide whether MAP planning is actually warranted for this task.
51
+
52
+ Assess these signals explicitly:
53
+ - `expected_diff_size`: `tiny` / `small` / `medium` / `large`
54
+ - `has_new_invariants`: does the task introduce or change domain model / contracts / schema rules?
55
+ - `needs_independent_review`: would this change be risky enough that independent review should be required?
56
+ - `has_clear_acceptance_criteria`: can the task already be executed without a planning pass?
57
+ - `test_first_required`: should later implementation use TDD because the behavior contract matters more than code speed?
58
+
59
+ For `/map-plan`, pick one of these outcomes:
60
+ - `direct-edit` — tiny, isolated work with clear acceptance criteria and no new invariants
61
+ - `map-fast` — small bounded change where MAP planning overhead is not justified
62
+ - `map-plan` — non-trivial work that should go through `SPEC + PLAN` before execution
63
+
64
+ Persist the decision:
65
+
66
+ ```bash
67
+ python3 .map/scripts/map_step_runner.py record_workflow_fit "<direct-edit|map-fast|map-plan>" "<tiny|small|medium|large>" "<true|false>" "<true|false>" "<true|false>" "<true|false>" "<one-sentence decision summary>"
68
+ ```
69
+
70
+ **Decision rules:**
71
+ - If the outcome is `direct-edit`: print a short off-ramp message explaining MAP is not needed and STOP.
72
+ - If the outcome is `map-fast`: recommend `/map-fast` and STOP.
73
+ - If the outcome is `map-plan`: continue with the steps below.
74
+
75
+ This is not a black box. The decision summary must state which signal(s) forced planning or justified the off-ramp.
76
+
46
77
  ### Step 0: Quick Discovery (Optional but Recommended)
47
78
 
48
79
  **IMPORTANT — Check for existing discovery first:**
@@ -566,6 +597,12 @@ Use the **Write** tool to create `.map/<branch>/step_state.json` with this struc
566
597
  - Populate `aag_contracts` map with each subtask's AAG contract from the decomposer output — executors read this to set context for each subtask
567
598
  - Populate `constraints` from the spec's Constraints section. null = unlimited (hook skips enforcement)
568
599
 
600
+ After writing `spec_<branch>.md`, `task_plan_<branch>.md`, `blueprint.json`, and `step_state.json`, record them in the artifact manifest:
601
+
602
+ ```bash
603
+ python3 .map/scripts/map_step_runner.py record_plan_artifacts
604
+ ```
605
+
569
606
  ### Step 8: Output Checkpoint
570
607
 
571
608
  Print a clear checkpoint showing the plan is complete:
@@ -582,6 +619,7 @@ WORKFLOW CHECKPOINT: PLAN PHASE COMPLETE
582
619
  ✅ Blueprint saved to .map/${BRANCH}/blueprint.json
583
620
  ✅ step_state.json initialized (with aag_contracts map)
584
621
  ✅ Plan written to .map/${BRANCH}/task_plan_${BRANCH}.md
622
+ ✅ artifact_manifest.json updated for spec + plan artifacts
585
623
  ✅ Context distilled (plan files ≤4000 tokens per subtask)
586
624
 
587
625
  Next Steps:
@@ -606,6 +644,7 @@ DISTILLATION CHECKLIST:
606
644
  [x] step_state.json — has aag_contracts map + subtask_sequence
607
645
  [x] blueprint.json — raw decomposer output for wave computation (with coverage_map)
608
646
  [x] spec_<branch>.md — has architecture graph + decisions + COMPLETE acceptance criteria (if interview was done)
647
+ [x] artifact_manifest.json — records workflow_fit + spec + plan stage artifacts
609
648
  [x] findings_<branch>.md — has research pointers (if discovery was done)
610
649
 
611
650
  TARGET: Executor reads ≤4000 tokens of distilled state to start any subtask.
@@ -353,6 +353,19 @@ This keeps `pr-draft.md` aligned with the latest review verdict and follow-up wo
353
353
 
354
354
  `active-issues.json` is the current unresolved set. Historical issues remain in `plan-review-00N.md`, `code-review-00N.md`, `qa-001.md`, and run dossiers under `.map/<branch>/runs/`.
355
355
 
356
+ 3. Write the deferred learning handoff so review lessons can be preserved later without hand-writing a summary:
357
+
358
+ ```bash
359
+ python3 .map/scripts/map_step_runner.py write_learning_handoff \
360
+ map-review \
361
+ "$ARGUMENTS" \
362
+ "<PROCEED|REVISE|BLOCK>" \
363
+ "<next action based on the verdict>" \
364
+ "<brief note about the most reusable review lesson>"
365
+ ```
366
+
367
+ This writes `.map/<branch>/learning-handoff.md` and `.json`, updates `artifact_manifest.json`, and allows `/map-learn` to auto-load the review context later with no extra reconstruction.
368
+
356
369
  ## CI/Auto Mode Behavior
357
370
 
358
371
  When `CI_MODE = true` (triggered by `--ci` or `--auto` in $ARGUMENTS):
@@ -367,7 +380,7 @@ When `CI_MODE = true` (triggered by `--ci` or `--auto` in $ARGUMENTS):
367
380
  If the review revealed valuable patterns or common issues worth preserving:
368
381
 
369
382
  ```
370
- /map-learn [review summary with key findings, resolution patterns, and verdict rationale]
383
+ /map-learn
371
384
  ```
372
385
 
373
386
  ## MCP Tools Used
@@ -35,8 +35,13 @@ fi
35
35
  ```bash
36
36
  BRANCH=$(git rev-parse --abbrev-ref HEAD | sed -E 's|/|-|g; s|[^a-zA-Z0-9_.-]|-|g; s|-{2,}|-|g; s|^-||; s|-$||')
37
37
 
38
- # Set up state for single subtask execution
39
- RESULT=$(python3 .map/scripts/map_orchestrator.py resume_single_subtask "$SUBTASK_ID")
38
+ # If a persisted TDD contract exists, resume implementation from ACTOR.
39
+ # Otherwise start normal single-subtask execution from RESEARCH.
40
+ if [ -f ".map/${BRANCH}/test_handoff_${SUBTASK_ID}.json" ] && [ -f ".map/${BRANCH}/test_contract_${SUBTASK_ID}.md" ]; then
41
+ RESULT=$(python3 .map/scripts/map_orchestrator.py resume_from_test_contract "$SUBTASK_ID")
42
+ else
43
+ RESULT=$(python3 .map/scripts/map_orchestrator.py resume_single_subtask "$SUBTASK_ID")
44
+ fi
40
45
  STATUS=$(echo "$RESULT" | jq -r '.status')
41
46
 
42
47
  if [ "$STATUS" = "error" ]; then
@@ -47,6 +52,7 @@ fi
47
52
 
48
53
  **If error mentions "No plan found":** Run `/map-plan` first to create a decomposition.
49
54
  **If error mentions "not found in plan":** The output lists available subtask IDs — pick one.
55
+ **If persisted TDD artifacts exist:** `/map-task` resumes at `ACTOR` using `test_contract_<subtask>.md` + `test_handoff_<subtask>.json` instead of restarting research.
50
56
 
51
57
  ## Step 2: Load Subtask Context
52
58
 
@@ -56,6 +62,9 @@ Read the plan to get the subtask's details:
56
62
  BRANCH=$(git rev-parse --abbrev-ref HEAD | sed -E 's|/|-|g; s|[^a-zA-Z0-9_.-]|-|g; s|-{2,}|-|g; s|^-||; s|-$||')
57
63
  # Read: .map/${BRANCH}/task_plan_${BRANCH}.md — find the ### ${SUBTASK_ID} section
58
64
  # Read: .map/${BRANCH}/blueprint.json — get AAG contract, validation_criteria, dependencies
65
+ # If present, also read:
66
+ # - .map/${BRANCH}/test_contract_${SUBTASK_ID}.md
67
+ # - .map/${BRANCH}/test_handoff_${SUBTASK_ID}.json
59
68
  ```
60
69
 
61
70
  Display a brief summary:
@@ -22,8 +22,10 @@ description: TDD workflow — test-first development with spec-driven tests writ
22
22
  ## Execution Flow
23
23
 
24
24
  ```
25
- Standard: DECOMPOSE → ACTOR (code+tests) → MONITOR
26
- TDD: DECOMPOSE → TEST_WRITER → TEST_FAIL_GATE → ACTOR (code only) MONITOR
25
+ Standard: DECOMPOSE → ACTOR (code+tests) → MONITOR
26
+ Targeted TDD: DECOMPOSE → TEST_WRITER → TEST_FAIL_GATE → CONTRACT_HANDOFFSTOP
27
+ Targeted Resume: /map-task ST-001 → ACTOR (code only) → MONITOR
28
+ Full-workflow TDD: DECOMPOSE → TEST_WRITER → TEST_FAIL_GATE → ACTOR (code only) → MONITOR
27
29
  ```
28
30
 
29
31
  **Task:** $ARGUMENTS
@@ -39,7 +41,7 @@ BRANCH=$(git rev-parse --abbrev-ref HEAD | sed -E 's|/|-|g; s|[^a-zA-Z0-9_.-]|-|
39
41
  ```
40
42
 
41
43
  **Two modes:**
42
- - **Single-subtask mode** (`/map-tdd ST-001`): Write tests + implement for ONE subtask only
44
+ - **Single-subtask mode** (`/map-tdd ST-001`): Write tests, persist a red-phase contract, then resume implementation separately
43
45
  - **Full workflow mode** (`/map-tdd "task description"`): TDD for all subtasks
44
46
 
45
47
  ### Single-Subtask Mode (when `$SUBTASK_ID` is detected)
@@ -56,7 +58,7 @@ if [ "$STATUS" = "error" ]; then
56
58
  fi
57
59
  ```
58
60
 
59
- Then proceed directly to **Step 1: State Machine Loop** below.
61
+ Then proceed directly to **Step 1: State Machine Loop** below. In single-subtask mode, the workflow should pause after `TEST_FAIL_GATE` once the persisted contract artifacts are written.
60
62
 
61
63
  ### Full Workflow Mode (no subtask ID)
62
64
 
@@ -225,11 +227,38 @@ a real bug, not just confirm one obvious branch."
225
227
  python3 .map/scripts/map_orchestrator.py validate_step "2.26"
226
228
  ```
227
229
 
230
+ **Single-subtask mode only: persist the red-phase contract before any implementation starts.**
231
+
232
+ When `$SUBTASK_ID` is non-empty, write `.map/${BRANCH}/test_contract_${SUBTASK_ID}.md` with:
233
+ - the subtask ID and title
234
+ - the AAG contract
235
+ - the test files created by TEST_WRITER
236
+ - the failing test command
237
+ - the behavior locked by the tests
238
+ - any constraints ACTOR must preserve
239
+
240
+ Then record the machine-readable handoff and stop this session:
241
+
242
+ ```bash
243
+ python3 .map/scripts/map_step_runner.py record_test_contract_handoff "$SUBTASK_ID" "<failing test command>" "<comma-separated test files>" "<one-sentence contract summary>" "<optional notes>"
244
+ python3 .map/scripts/map_orchestrator.py mark_contract_ready "$SUBTASK_ID"
245
+ ```
246
+
247
+ After that, STOP and tell the user to resume implementation with:
248
+
249
+ ```text
250
+ /map-task ST-001
251
+ ```
252
+
253
+ That follow-up command will detect `test_handoff_${SUBTASK_ID}.json` and resume at `ACTOR` with the persisted contract, instead of re-running research or test writing.
254
+
255
+ When `$SUBTASK_ID` is empty (full-workflow mode), do **not** write `test_contract_.md`, do **not** call `mark_contract_ready ""`, and do **not** stop the workflow here. In full-workflow mode, `TEST_FAIL_GATE` continues directly into `ACTOR` for the current subtask.
256
+
228
257
  ---
229
258
 
230
259
  ## Phase: ACTOR in TDD Mode (2.3)
231
260
 
232
- When TDD mode is active, Actor receives a modified prompt:
261
+ When implementation resumes from the persisted TDD contract, Actor receives a modified prompt:
233
262
 
234
263
  ```python
235
264
  Task(
@@ -303,12 +332,13 @@ Monitor verifies both implementation correctness AND that all tests pass.
303
332
 
304
333
  `/map-tdd` uses the same branch-scoped execution artifacts as `/map-efficient` because it runs through the same orchestrated state machine with extra TDD phases:
305
334
 
306
-
307
335
  - `code-review-00N.md`
308
336
  - `qa-001.md`
309
337
  - `pr-draft.md`
338
+ - `test_contract_ST-00N.md`
339
+ - `test_handoff_ST-00N.json`
310
340
 
311
- In TDD mode, `TEST_WRITER` and `TEST_FAIL_GATE` should append to the same branch workspace instead of creating a separate artifact universe.
341
+ In TDD mode, `TEST_WRITER` and `TEST_FAIL_GATE` still write into the same branch workspace, but they must now leave behind a persisted contract that `/map-task` can resume from in a clean implementation session.
312
342
 
313
343
  ---
314
344
 
@@ -324,7 +354,7 @@ In TDD mode, `TEST_WRITER` and `TEST_FAIL_GATE` should append to the same branch
324
354
  ## Related Commands
325
355
 
326
356
  - **/map-plan** — Create spec with invariants and acceptance criteria (recommended before /map-tdd)
327
- - **/map-task ST-001** — Execute a single subtask without TDD (implementation only)
357
+ - **/map-task ST-001** — Resume implementation from a persisted TDD contract or execute a normal single subtask
328
358
  - **/map-efficient** — Standard workflow without test-first constraint
329
359
  - **/map-check** — Final verification after all subtasks complete
330
360
  - **/map-learn** — Extract lessons from completed TDD workflow