mapify-cli 3.6.0__tar.gz → 3.7.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 (103) hide show
  1. {mapify_cli-3.6.0 → mapify_cli-3.7.0}/.gitignore +2 -0
  2. {mapify_cli-3.6.0 → mapify_cli-3.7.0}/PKG-INFO +5 -2
  3. {mapify_cli-3.6.0 → mapify_cli-3.7.0}/README.md +4 -1
  4. {mapify_cli-3.6.0 → mapify_cli-3.7.0}/pyproject.toml +1 -1
  5. {mapify_cli-3.6.0 → mapify_cli-3.7.0}/src/mapify_cli/__init__.py +1 -1
  6. {mapify_cli-3.6.0 → mapify_cli-3.7.0}/src/mapify_cli/delivery/file_copier.py +0 -1
  7. {mapify_cli-3.6.0 → mapify_cli-3.7.0}/src/mapify_cli/delivery/managed_file_copier.py +33 -0
  8. {mapify_cli-3.6.0 → mapify_cli-3.7.0}/src/mapify_cli/repo_insight.py +76 -0
  9. {mapify_cli-3.6.0 → mapify_cli-3.7.0}/src/mapify_cli/templates/agents/actor.md +22 -4
  10. {mapify_cli-3.6.0 → mapify_cli-3.7.0}/src/mapify_cli/templates/agents/monitor.md +77 -27
  11. {mapify_cli-3.6.0 → mapify_cli-3.7.0}/src/mapify_cli/templates/agents/task-decomposer.md +19 -1
  12. {mapify_cli-3.6.0 → mapify_cli-3.7.0}/src/mapify_cli/templates/commands/map-efficient.md +237 -119
  13. {mapify_cli-3.6.0 → mapify_cli-3.7.0}/src/mapify_cli/templates/commands/map-plan.md +78 -5
  14. {mapify_cli-3.6.0 → mapify_cli-3.7.0}/src/mapify_cli/templates/commands/map-review.md +14 -0
  15. {mapify_cli-3.6.0 → mapify_cli-3.7.0}/src/mapify_cli/templates/commands/map-task.md +2 -2
  16. {mapify_cli-3.6.0 → mapify_cli-3.7.0}/src/mapify_cli/templates/commands/map-tdd.md +44 -2
  17. {mapify_cli-3.6.0 → mapify_cli-3.7.0}/src/mapify_cli/templates/hooks/workflow-context-injector.py +80 -3
  18. {mapify_cli-3.6.0 → mapify_cli-3.7.0}/src/mapify_cli/templates/map/scripts/map_orchestrator.py +313 -6
  19. {mapify_cli-3.6.0 → mapify_cli-3.7.0}/src/mapify_cli/templates/map/scripts/map_step_runner.py +237 -3
  20. {mapify_cli-3.6.0 → mapify_cli-3.7.0}/src/mapify_cli/templates/skills/skill-rules.json +0 -46
  21. {mapify_cli-3.6.0 → mapify_cli-3.7.0}/src/mapify_cli/templates/workflow-rules.json +0 -19
  22. mapify_cli-3.6.0/src/mapify_cli/templates/commands/map-debate.md +0 -408
  23. mapify_cli-3.6.0/src/mapify_cli/templates/skills/map-cli-reference/SKILL.md +0 -124
  24. mapify_cli-3.6.0/src/mapify_cli/templates/skills/map-cli-reference/scripts/check-command.sh +0 -117
  25. mapify_cli-3.6.0/src/mapify_cli/templates/skills/map-workflows-guide/SKILL.md +0 -529
  26. mapify_cli-3.6.0/src/mapify_cli/templates/skills/map-workflows-guide/resources/agent-architecture.md +0 -266
  27. mapify_cli-3.6.0/src/mapify_cli/templates/skills/map-workflows-guide/resources/map-debug-deep-dive.md +0 -258
  28. mapify_cli-3.6.0/src/mapify_cli/templates/skills/map-workflows-guide/resources/map-efficient-deep-dive.md +0 -202
  29. mapify_cli-3.6.0/src/mapify_cli/templates/skills/map-workflows-guide/resources/map-fast-deep-dive.md +0 -234
  30. mapify_cli-3.6.0/src/mapify_cli/templates/skills/map-workflows-guide/resources/map-feature-deep-dive.md +0 -235
  31. mapify_cli-3.6.0/src/mapify_cli/templates/skills/map-workflows-guide/resources/map-refactor-deep-dive.md +0 -332
  32. mapify_cli-3.6.0/src/mapify_cli/templates/skills/map-workflows-guide/scripts/validate-workflow-choice.py +0 -159
  33. {mapify_cli-3.6.0 → mapify_cli-3.7.0}/.claude/skills/README.md +0 -0
  34. {mapify_cli-3.6.0 → mapify_cli-3.7.0}/src/mapify_cli/cli_ui.py +0 -0
  35. {mapify_cli-3.6.0 → mapify_cli-3.7.0}/src/mapify_cli/config/__init__.py +0 -0
  36. {mapify_cli-3.6.0 → mapify_cli-3.7.0}/src/mapify_cli/config/mcp.py +0 -0
  37. {mapify_cli-3.6.0 → mapify_cli-3.7.0}/src/mapify_cli/config/project_config.py +0 -0
  38. {mapify_cli-3.6.0 → mapify_cli-3.7.0}/src/mapify_cli/config/settings.py +0 -0
  39. {mapify_cli-3.6.0 → mapify_cli-3.7.0}/src/mapify_cli/delivery/__init__.py +0 -0
  40. {mapify_cli-3.6.0 → mapify_cli-3.7.0}/src/mapify_cli/delivery/agent_generator.py +0 -0
  41. {mapify_cli-3.6.0 → mapify_cli-3.7.0}/src/mapify_cli/dependency_graph.py +0 -0
  42. {mapify_cli-3.6.0 → mapify_cli-3.7.0}/src/mapify_cli/intent_detector.py +0 -0
  43. {mapify_cli-3.6.0 → mapify_cli-3.7.0}/src/mapify_cli/ralph_state.py +0 -0
  44. {mapify_cli-3.6.0 → mapify_cli-3.7.0}/src/mapify_cli/schemas.py +0 -0
  45. {mapify_cli-3.6.0 → mapify_cli-3.7.0}/src/mapify_cli/templates/CLAUDE.md +0 -0
  46. {mapify_cli-3.6.0 → mapify_cli-3.7.0}/src/mapify_cli/templates/agents/debate-arbiter.md +0 -0
  47. {mapify_cli-3.6.0 → mapify_cli-3.7.0}/src/mapify_cli/templates/agents/documentation-reviewer.md +0 -0
  48. {mapify_cli-3.6.0 → mapify_cli-3.7.0}/src/mapify_cli/templates/agents/evaluator.md +0 -0
  49. {mapify_cli-3.6.0 → mapify_cli-3.7.0}/src/mapify_cli/templates/agents/final-verifier.md +0 -0
  50. {mapify_cli-3.6.0 → mapify_cli-3.7.0}/src/mapify_cli/templates/agents/predictor.md +0 -0
  51. {mapify_cli-3.6.0 → mapify_cli-3.7.0}/src/mapify_cli/templates/agents/reflector.md +0 -0
  52. {mapify_cli-3.6.0 → mapify_cli-3.7.0}/src/mapify_cli/templates/agents/research-agent.md +0 -0
  53. {mapify_cli-3.6.0 → mapify_cli-3.7.0}/src/mapify_cli/templates/agents/synthesizer.md +0 -0
  54. {mapify_cli-3.6.0 → mapify_cli-3.7.0}/src/mapify_cli/templates/commands/map-check.md +0 -0
  55. {mapify_cli-3.6.0 → mapify_cli-3.7.0}/src/mapify_cli/templates/commands/map-debug.md +0 -0
  56. {mapify_cli-3.6.0 → mapify_cli-3.7.0}/src/mapify_cli/templates/commands/map-fast.md +0 -0
  57. {mapify_cli-3.6.0 → mapify_cli-3.7.0}/src/mapify_cli/templates/commands/map-learn.md +0 -0
  58. {mapify_cli-3.6.0 → mapify_cli-3.7.0}/src/mapify_cli/templates/commands/map-release.md +0 -0
  59. {mapify_cli-3.6.0 → mapify_cli-3.7.0}/src/mapify_cli/templates/commands/map-resume.md +0 -0
  60. {mapify_cli-3.6.0 → mapify_cli-3.7.0}/src/mapify_cli/templates/hooks/end-of-turn.sh +0 -0
  61. {mapify_cli-3.6.0 → mapify_cli-3.7.0}/src/mapify_cli/templates/hooks/post-compact-context.py +0 -0
  62. {mapify_cli-3.6.0 → mapify_cli-3.7.0}/src/mapify_cli/templates/hooks/pre-compact-save-transcript.py +0 -0
  63. {mapify_cli-3.6.0 → mapify_cli-3.7.0}/src/mapify_cli/templates/hooks/ralph-context-pruner.py +0 -0
  64. {mapify_cli-3.6.0 → mapify_cli-3.7.0}/src/mapify_cli/templates/hooks/ralph-iteration-logger.py +0 -0
  65. {mapify_cli-3.6.0 → mapify_cli-3.7.0}/src/mapify_cli/templates/hooks/safety-guardrails.py +0 -0
  66. {mapify_cli-3.6.0 → mapify_cli-3.7.0}/src/mapify_cli/templates/hooks/workflow-gate.py +0 -0
  67. {mapify_cli-3.6.0 → mapify_cli-3.7.0}/src/mapify_cli/templates/map/scripts/diagnostics.py +0 -0
  68. {mapify_cli-3.6.0 → mapify_cli-3.7.0}/src/mapify_cli/templates/map/scripts/map_utils.py +0 -0
  69. {mapify_cli-3.6.0 → mapify_cli-3.7.0}/src/mapify_cli/templates/map/static-analysis/analyze.sh +0 -0
  70. {mapify_cli-3.6.0 → mapify_cli-3.7.0}/src/mapify_cli/templates/map/static-analysis/handlers/common.sh +0 -0
  71. {mapify_cli-3.6.0 → mapify_cli-3.7.0}/src/mapify_cli/templates/map/static-analysis/handlers/go.sh +0 -0
  72. {mapify_cli-3.6.0 → mapify_cli-3.7.0}/src/mapify_cli/templates/map/static-analysis/handlers/python.sh +0 -0
  73. {mapify_cli-3.6.0 → mapify_cli-3.7.0}/src/mapify_cli/templates/map/static-analysis/handlers/rust.sh +0 -0
  74. {mapify_cli-3.6.0 → mapify_cli-3.7.0}/src/mapify_cli/templates/map/static-analysis/handlers/typescript.sh +0 -0
  75. {mapify_cli-3.6.0 → mapify_cli-3.7.0}/src/mapify_cli/templates/ralph-loop-config.json +0 -0
  76. {mapify_cli-3.6.0 → mapify_cli-3.7.0}/src/mapify_cli/templates/references/bash-guidelines.md +0 -0
  77. {mapify_cli-3.6.0 → mapify_cli-3.7.0}/src/mapify_cli/templates/references/decomposition-examples.md +0 -0
  78. {mapify_cli-3.6.0 → mapify_cli-3.7.0}/src/mapify_cli/templates/references/escalation-matrix.md +0 -0
  79. {mapify_cli-3.6.0 → mapify_cli-3.7.0}/src/mapify_cli/templates/references/mcp-usage-examples.md +0 -0
  80. {mapify_cli-3.6.0 → mapify_cli-3.7.0}/src/mapify_cli/templates/references/step-state-schema.md +0 -0
  81. {mapify_cli-3.6.0 → mapify_cli-3.7.0}/src/mapify_cli/templates/references/workflow-state-schema.md +0 -0
  82. {mapify_cli-3.6.0 → mapify_cli-3.7.0}/src/mapify_cli/templates/rules/learned/README.md +0 -0
  83. {mapify_cli-3.6.0 → mapify_cli-3.7.0}/src/mapify_cli/templates/settings.json +0 -0
  84. {mapify_cli-3.6.0 → mapify_cli-3.7.0}/src/mapify_cli/templates/skills/README.md +0 -0
  85. {mapify_cli-3.6.0 → mapify_cli-3.7.0}/src/mapify_cli/templates/skills/map-learn/SKILL.md +0 -0
  86. {mapify_cli-3.6.0 → mapify_cli-3.7.0}/src/mapify_cli/templates/skills/map-learn/templates/example-rules.md +0 -0
  87. {mapify_cli-3.6.0 → mapify_cli-3.7.0}/src/mapify_cli/templates/skills/map-learn/templates/rules-unconditional.md +0 -0
  88. {mapify_cli-3.6.0 → mapify_cli-3.7.0}/src/mapify_cli/templates/skills/map-learn/templates/rules-with-paths.md +0 -0
  89. {mapify_cli-3.6.0 → mapify_cli-3.7.0}/src/mapify_cli/templates/skills/map-planning/SKILL.md +0 -0
  90. {mapify_cli-3.6.0 → mapify_cli-3.7.0}/src/mapify_cli/templates/skills/map-planning/scripts/check-complete.sh +0 -0
  91. {mapify_cli-3.6.0 → mapify_cli-3.7.0}/src/mapify_cli/templates/skills/map-planning/scripts/get-plan-path.sh +0 -0
  92. {mapify_cli-3.6.0 → mapify_cli-3.7.0}/src/mapify_cli/templates/skills/map-planning/scripts/init-session.sh +0 -0
  93. {mapify_cli-3.6.0 → mapify_cli-3.7.0}/src/mapify_cli/templates/skills/map-planning/scripts/show-focus.sh +0 -0
  94. {mapify_cli-3.6.0 → mapify_cli-3.7.0}/src/mapify_cli/templates/skills/map-planning/templates/findings.md +0 -0
  95. {mapify_cli-3.6.0 → mapify_cli-3.7.0}/src/mapify_cli/templates/skills/map-planning/templates/iteration_history.md +0 -0
  96. {mapify_cli-3.6.0 → mapify_cli-3.7.0}/src/mapify_cli/templates/skills/map-planning/templates/progress.md +0 -0
  97. {mapify_cli-3.6.0 → mapify_cli-3.7.0}/src/mapify_cli/templates/skills/map-planning/templates/task_plan.md +0 -0
  98. {mapify_cli-3.6.0 → mapify_cli-3.7.0}/src/mapify_cli/tools/__init__.py +0 -0
  99. {mapify_cli-3.6.0 → mapify_cli-3.7.0}/src/mapify_cli/tools/validate_dependencies.py +0 -0
  100. {mapify_cli-3.6.0 → mapify_cli-3.7.0}/src/mapify_cli/verification_recorder.py +0 -0
  101. {mapify_cli-3.6.0 → mapify_cli-3.7.0}/src/mapify_cli/workflow_finalizer.py +0 -0
  102. {mapify_cli-3.6.0 → mapify_cli-3.7.0}/src/mapify_cli/workflow_logger.py +0 -0
  103. {mapify_cli-3.6.0 → mapify_cli-3.7.0}/src/mapify_cli/workflow_state.py +0 -0
@@ -42,11 +42,13 @@ coverage.json
42
42
  .claude/sessions/
43
43
  .claude/metrics/
44
44
  .claude/cache/
45
+ .claude/worktrees/
45
46
 
46
47
  # MAP runtime files (but keep static-analysis and orchestrator scripts)
47
48
  .map/*
48
49
  !.map/static-analysis/
49
50
  !.map/scripts/
51
+ .map/scripts/.map/
50
52
 
51
53
  # Temporary verification files
52
54
  mapify_cli_verification_*.json
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mapify-cli
3
- Version: 3.6.0
3
+ Version: 3.7.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
@@ -80,7 +80,6 @@ claude
80
80
  | `/map-efficient` | Production features, refactoring, complex tasks (recommended) |
81
81
  | `/map-debug` | Bug fixes and debugging |
82
82
  | `/map-fast` | Small, low-risk changes |
83
- | `/map-debate` | Complex decisions with multi-variant synthesis |
84
83
  | `/map-review` | Pre-commit code review |
85
84
  | `/map-check` | Quality gates and verification |
86
85
  | `/map-plan` | Task decomposition without implementation |
@@ -127,6 +126,10 @@ The orchestration lives in `.claude/commands/map-*.md` prompts created by `mapif
127
126
  | [Architecture](docs/ARCHITECTURE.md) | Agents, MCP integration, customization |
128
127
  | [Platform Spec](docs/MAP_PLATFORM_SPEC.md) | Platform refactor roadmap, codebase analysis |
129
128
 
129
+ ## Case Study
130
+
131
+ - [DevOpsConf 2026 case study](https://github.com/azalio/devopsconf-ai-develop) — real production case: SPEC -> PLAN -> TEST -> CODE -> REVIEW -> LEARN
132
+
130
133
  ## Trouble?
131
134
 
132
135
  - **Command not found** → Run `mapify init` in your project first
@@ -48,7 +48,6 @@ claude
48
48
  | `/map-efficient` | Production features, refactoring, complex tasks (recommended) |
49
49
  | `/map-debug` | Bug fixes and debugging |
50
50
  | `/map-fast` | Small, low-risk changes |
51
- | `/map-debate` | Complex decisions with multi-variant synthesis |
52
51
  | `/map-review` | Pre-commit code review |
53
52
  | `/map-check` | Quality gates and verification |
54
53
  | `/map-plan` | Task decomposition without implementation |
@@ -95,6 +94,10 @@ The orchestration lives in `.claude/commands/map-*.md` prompts created by `mapif
95
94
  | [Architecture](docs/ARCHITECTURE.md) | Agents, MCP integration, customization |
96
95
  | [Platform Spec](docs/MAP_PLATFORM_SPEC.md) | Platform refactor roadmap, codebase analysis |
97
96
 
97
+ ## Case Study
98
+
99
+ - [DevOpsConf 2026 case study](https://github.com/azalio/devopsconf-ai-develop) — real production case: SPEC -> PLAN -> TEST -> CODE -> REVIEW -> LEARN
100
+
98
101
  ## Trouble?
99
102
 
100
103
  - **Command not found** → Run `mapify init` in your project first
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "mapify-cli"
3
- version = "3.6.0"
3
+ version = "3.7.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.6.0"
26
+ __version__ = "3.7.0"
27
27
 
28
28
  import os
29
29
  import subprocess
@@ -312,7 +312,6 @@ This directory contains custom slash commands for Claude Code.
312
312
  - `/map-task` - Execute a single subtask from an existing plan
313
313
  - `/map-tdd` - Run a test-first workflow for one task or plan
314
314
  - `/map-debug` - Debug issues using MAP analysis
315
- - `/map-debate` - Generate variants and synthesize the best result
316
315
  - `/map-review` - Run a structured review workflow
317
316
  - `/map-check` - Run workflow quality gates and verification
318
317
  - `/map-fast` - Quick implementation with minimal validation
@@ -103,6 +103,17 @@ def inject_metadata(content: str, ext: str, version: str, template_hash: str) ->
103
103
 
104
104
  if ext == ".md":
105
105
  header = f"<!-- {_MANAGED_TAG}: {meta_json} -->\n"
106
+ # If content has YAML frontmatter (starts with ---), insert after
107
+ # closing --- to preserve frontmatter parsing by tools like Claude Code.
108
+ if content.startswith("---\n"):
109
+ end_idx = content.find("\n---\n", 3)
110
+ if end_idx != -1:
111
+ insert_pos = end_idx + 5 # after \n---\n
112
+ return content[:insert_pos] + header + content[insert_pos:]
113
+ # Edge case: closing --- at very end (no trailing newline)
114
+ end_idx = content.find("\n---", 3)
115
+ if end_idx != -1 and end_idx + 4 == len(content):
116
+ return content + "\n" + header
106
117
  return header + content
107
118
 
108
119
  if ext == ".py":
@@ -135,6 +146,7 @@ def extract_metadata(content: str, ext: str) -> tuple[Optional[dict[str, Any]],
135
146
  Returns (None, original_content) if no metadata found.
136
147
  """
137
148
  if ext == ".md":
149
+ # Try at start of file (non-frontmatter .md files)
138
150
  m = _MD_PATTERN.match(content)
139
151
  if m:
140
152
  try:
@@ -142,6 +154,27 @@ def extract_metadata(content: str, ext: str) -> tuple[Optional[dict[str, Any]],
142
154
  return meta, content[m.end() :]
143
155
  except json.JSONDecodeError:
144
156
  pass
157
+ # Try after YAML frontmatter (agent .md files with ---)
158
+ if content.startswith("---\n"):
159
+ end_idx = content.find("\n---\n", 3)
160
+ if end_idx != -1:
161
+ after_fm = end_idx + 5
162
+ rest = content[after_fm:]
163
+ m = _MD_PATTERN.match(rest)
164
+ if m:
165
+ try:
166
+ meta = json.loads(m.group(1))
167
+ clean = content[:after_fm] + rest[m.end() :]
168
+ # If nothing followed the MAP-MANAGED comment (it was
169
+ # at EOF) and clean ends with "\n---\n", the trailing
170
+ # newline was injected by inject_metadata for the
171
+ # frontmatter-at-EOF edge case. Strip it to restore
172
+ # the original content that had no trailing newline.
173
+ if not rest[m.end() :] and clean.endswith("\n---\n"):
174
+ clean = clean[:-1]
175
+ return meta, clean
176
+ except json.JSONDecodeError:
177
+ pass
145
178
  return None, content
146
179
 
147
180
  if ext == ".py":
@@ -7,6 +7,7 @@ and key directories for workflow initialization.
7
7
  from pathlib import Path
8
8
  from typing import List
9
9
  import json
10
+ import subprocess
10
11
 
11
12
 
12
13
  def detect_language(project_root: Path) -> str:
@@ -201,3 +202,78 @@ def _validate_repo_insight_schema(data: dict) -> None:
201
202
  for dir_path in data["key_dirs"]:
202
203
  if dir_path.startswith("/"):
203
204
  raise ValueError(f"key_dirs must be relative paths: {dir_path}")
205
+
206
+
207
+ def compute_differential_insight(project_root: Path, since_sha: str | None) -> dict:
208
+ """Compute file changes since a given git SHA.
209
+
210
+ Used for context-aware injection: shows Actor only files
211
+ that changed since the last subtask completed.
212
+
213
+ Args:
214
+ project_root: Path to project root
215
+ since_sha: Git SHA to diff against (None = no baseline)
216
+
217
+ Returns:
218
+ Dict with changed_files, deleted_files. On success also includes
219
+ since_sha and current_sha. On error: empty lists and error key.
220
+ When since_sha is None: empty lists and note key.
221
+ """
222
+ if since_sha is None:
223
+ return {"changed_files": [], "deleted_files": [], "note": "no baseline SHA"}
224
+
225
+ try:
226
+ # Get changed/added/modified/renamed files
227
+ result = subprocess.run(
228
+ ["git", "diff", "--name-only", "--diff-filter=ACMR", since_sha, "HEAD"],
229
+ capture_output=True,
230
+ text=True,
231
+ cwd=project_root,
232
+ timeout=2,
233
+ )
234
+ if result.returncode != 0:
235
+ return {
236
+ "changed_files": [],
237
+ "deleted_files": [],
238
+ "error": f"git diff failed: {result.stderr.strip()}",
239
+ }
240
+ changed = [f for f in result.stdout.strip().split("\n") if f]
241
+
242
+ # Get deleted files
243
+ result_del = subprocess.run(
244
+ ["git", "diff", "--name-only", "--diff-filter=D", since_sha, "HEAD"],
245
+ capture_output=True,
246
+ text=True,
247
+ cwd=project_root,
248
+ timeout=2,
249
+ )
250
+ deleted = (
251
+ [f for f in result_del.stdout.strip().split("\n") if f]
252
+ if result_del.returncode == 0
253
+ else []
254
+ )
255
+
256
+ # Get current HEAD SHA
257
+ head_result = subprocess.run(
258
+ ["git", "rev-parse", "HEAD"],
259
+ capture_output=True,
260
+ text=True,
261
+ cwd=project_root,
262
+ timeout=2,
263
+ )
264
+ current_sha = (
265
+ head_result.stdout.strip() if head_result.returncode == 0 else "unknown"
266
+ )
267
+
268
+ return {
269
+ "changed_files": changed,
270
+ "deleted_files": deleted,
271
+ "since_sha": since_sha,
272
+ "current_sha": current_sha,
273
+ }
274
+ except (subprocess.TimeoutExpired, FileNotFoundError, OSError) as e:
275
+ return {
276
+ "changed_files": [],
277
+ "deleted_files": [],
278
+ "error": str(e),
279
+ }
@@ -200,10 +200,15 @@ Task(
200
200
  - Use Read(path, offset=lines[0], limit=lines[1]-lines[0]+1) # lines = [start, end], inclusive
201
201
  - Don't read all locations — only what you actually need
202
202
 
203
- ## Skip Research If
203
+ ## Research Usage
204
204
 
205
- - Task is self-contained (new file, no dependencies)
206
- - Existing patterns from context already cover the need
205
+ Research is run by the orchestrator BEFORE Actor is invoked. The findings file
206
+ (`.map/<branch>/findings_<branch>.md`) contains distilled context. If it exists,
207
+ read it before implementation — it has import patterns, module structure, and
208
+ build configuration that prevent integration failures.
209
+
210
+ Do NOT skip reading the findings file even for "new file" tasks — new files still
211
+ need correct imports, types, and build configuration from the existing project.
207
212
 
208
213
  ---
209
214
 
@@ -276,6 +281,9 @@ Rules:
276
281
  5. Include edge cases from the spec's `## Edge Cases` section if available in the packet.
277
282
  6. Use standard test patterns for the project's language and framework.
278
283
  7. Tests SHOULD fail when run (implementation doesn't exist yet). This is expected.
284
+ 8. Do NOT add temporal comments about test failure status (e.g., "currently FAILS",
285
+ "expected to FAIL", "will PASS once fix is applied"). Write tests as permanent,
286
+ clean code — the Red/Green state is transient and must not leak into comments.
279
287
 
280
288
  Output:
281
289
  - Test files created via Write tool
@@ -408,7 +416,17 @@ VC1: <criterion text>
408
416
  - Tests: path/to/test_file.ext::test_name (or N/A with reason)
409
417
  ```
410
418
 
411
- ## 7. Integration Notes (If Applicable)
419
+ ## 7. Downstream Consumption Check
420
+
421
+ When implementing a component whose output is consumed by another component:
422
+
423
+ - **Identify the consumer**: What reads your output? Verify your output populates ALL fields it expects.
424
+ - **Self-bootstrap**: Does your code load its own dependencies from config/storage, or does it silently return empty results when input is not pre-populated by the caller?
425
+ - **Stub replacement**: If implementing a real version of a placeholder, verify it is wired into the runtime — not just available as a standalone function.
426
+
427
+ Skip this section for leaf components with no downstream consumers.
428
+
429
+ ## 8. Integration Notes (If Applicable)
412
430
 
413
431
  Only include if changes affect:
414
432
  - Database schema (migrations needed?)
@@ -16,16 +16,17 @@ You are a Protocol-Driven Validation System. Your objective: verify that Actor's
16
16
 
17
17
  **CRITICAL: Monitor is READ-ONLY reviewer, NOT a code editor**
18
18
 
19
- You are a **validation agent**, NOT a code executor. Your role:
19
+ You are a **validation agent**, NOT a code editor. Your role:
20
20
 
21
21
  - ✅ DO: Review Actor's code proposals and output JSON feedback
22
22
  - ✅ DO: Use Read tool to examine existing code for context
23
+ - ✅ DO: Run read-only build/test commands (tsc --noEmit, go build, pytest, etc.) to verify code compiles and passes
23
24
  - ❌ NEVER: Use Edit or MultiEdit tools
24
25
  - ⚠️ EXCEPTION: Write tool is permitted ONLY for evidence artifacts (.map/ directory)
25
26
  - ❌ NEVER: Modify source files directly
26
27
  - ❌ NEVER: "Fix code for Actor" - only REPORT issues
27
28
  - 📋 WHY: workflow-gate.py will BLOCK Edit and non-evidence Write during monitor phase
28
- - 🔄 FLOW: Actor outputs → **You review** → Orchestrator applies (if approved)
29
+ - 🔄 FLOW: Actor outputs → **You review + run build/tests** → Orchestrator applies (if approved)
29
30
 
30
31
  **Your output**: JSON with `valid: true|false` and `issues[]` array
31
32
 
@@ -39,10 +40,16 @@ You are a **validation agent**, NOT a code executor. Your role:
39
40
 
40
41
  **Verification sequence (execute in order):**
41
42
  1. Parse AAG contract from prompt — extract Actor, Action, Goal
42
- 2. Verify Goal is achieved trace code path to confirm the stated outcome
43
- 3. Verify Action is implemented check that the specified method/operation exists
44
- 4. Verify scope confirm changes stay within Actor's allowed_scope
45
- 5. Run quality gates below
43
+ 2. **BUILD GATE (MANDATORYrun FIRST):** Run the project's build/compile command:
44
+ - TypeScript: `npx tsc --noEmit` (or `npm run build`)
45
+ - Python: `python -m py_compile <changed_files>` (or mypy if configured)
46
+ - Go: `go build ./...`
47
+ - Rust: `cargo check`
48
+ - If build/compile fails → `valid: false` immediately with compilation errors. Do NOT proceed to other checks.
49
+ 3. Verify Goal is achieved — trace code path to confirm the stated outcome
50
+ 4. Verify Action is implemented — check that the specified method/operation exists
51
+ 5. Verify scope — confirm changes stay within Actor's allowed_scope
52
+ 6. Run quality gates below
46
53
 
47
54
  **Deterministic REJECT rule:**
48
55
  If implementation deviates from the AAG contract — `valid: false` — regardless of how "clean" or "elegant" the code is. The contract IS the specification; aesthetic quality is irrelevant when the contract is violated.
@@ -50,15 +57,16 @@ If implementation deviates from the AAG contract — `valid: false` — regardle
50
57
  **Escalation Framework:**
51
58
 
52
59
  🔴 **AUTO-REJECT (valid: false, must fix):**
53
- 1. **AAG contract violation** — implementation does not satisfy Actor -> Action -> Goal
54
- 2. Missing error handling on network/database/file operations
55
- 3. No input validation on user-provided data
56
- 4. SQL string concatenation (injection vulnerability)
57
- 5. Hardcoded secrets (API keys, passwords, tokens)
58
- 6. Silent failures (try/catch with empty handler)
59
- 7. Deprecated APIs without migration plan
60
- 8. Security score < 7 OR functionality score < 7
61
- 9. **Missing intent comments** non-obvious logic blocks without `# Intent: <why>` comments, or removal of existing intent comments that describe author's reasoning
60
+ 1. **Build/compile failure** — code does not compile (`tsc --noEmit`, `go build`, `cargo check`, `py_compile` fails)
61
+ 2. **AAG contract violation** implementation does not satisfy Actor -> Action -> Goal
62
+ 3. Missing error handling on network/database/file operations
63
+ 4. No input validation on user-provided data
64
+ 5. SQL string concatenation (injection vulnerability)
65
+ 6. Hardcoded secrets (API keys, passwords, tokens)
66
+ 7. Silent failures (try/catch with empty handler)
67
+ 8. Deprecated APIs without migration plan
68
+ 9. Security score < 7 OR functionality score < 7
69
+ 10. **Missing intent comments** — non-obvious logic blocks without `# Intent: <why>` comments, or removal of existing intent comments that describe author's reasoning
62
70
 
63
71
  🟡 **WARN (should address, not blocking):**
64
72
  1. Missing edge case tests (empty arrays, null values)
@@ -280,8 +288,8 @@ IF detected_language != "unknown":
280
288
  → Consider language-specific static analysis tools
281
289
 
282
290
  PHASE 3: EXHAUSTIVE DIMENSION VALIDATION (ALWAYS)
283
- Execute validation protocol for each of the 10 dimensions sequentially.
284
- Do NOT skip dimensions based on early findings — complete ALL 10.
291
+ Execute validation protocol for each of the 11 dimensions sequentially.
292
+ Do NOT skip dimensions based on early findings — complete ALL 11.
285
293
  For each dimension: parse criteria → verify against code → record PASS/FAIL.
286
294
  Apply language-specific validation rules per dimension.
287
295
 
@@ -852,11 +860,11 @@ Include in JSON output when validation_criteria provided:
852
860
 
853
861
  </Monitor_Contract_Validation>
854
862
 
855
- <Monitor_10D_Validation_v2_9>
863
+ <Monitor_11D_Validation_v3_0>
856
864
 
857
- ## 10-Dimension Quality Model
865
+ ## 11-Dimension Quality Model
858
866
 
859
- Execute validation protocol for EACH dimension sequentially. Do NOT short-circuit — complete ALL 10 dimensions even if early rejections found. Output structured findings per dimension.
867
+ Execute validation protocol for EACH dimension sequentially. Do NOT short-circuit — complete ALL 11 dimensions even if early rejections found. Output structured findings per dimension. **Exception:** BUILD GATE failure (step 2 of Verification sequence) is the single allowed short-circuit — if build/compile fails, set `valid: false` immediately without completing dimension checks.
860
868
 
861
869
  ### 1. CORRECTNESS
862
870
 
@@ -1374,7 +1382,47 @@ ELSE:
1374
1382
  - Post-cutoff library + no research + outdated patterns
1375
1383
  </critical>
1376
1384
 
1377
- </Monitor_10D_Validation_v2_9>
1385
+ ### 11. INTEGRATION (When subtask has upstream/downstream dependencies)
1386
+
1387
+ #### What to Check
1388
+ - Output consumed correctly by downstream components (not silently dropped)
1389
+ - Component self-bootstraps from config/storage (does not require caller to pre-populate dependencies)
1390
+ - Stubs/placeholders replaced by real implementations in the runtime entrypoint
1391
+ - Interface contracts between components are satisfied in both directions
1392
+
1393
+ #### How to Check
1394
+ 1. Identify downstream consumers of this subtask's output
1395
+ 2. Trace the data path: does the output reach the consumer with the expected shape?
1396
+ 3. Check if the component loads its own dependencies or silently returns empty/stub results
1397
+ 4. Verify the runtime entrypoint uses the real implementation, not a placeholder
1398
+
1399
+ #### Pass Criteria
1400
+ - Output is demonstrably consumed by at least one downstream component
1401
+ - Component works when invoked through the runtime entrypoint (not just direct calls)
1402
+ - No silent fallback to stub/empty results on missing dependencies
1403
+
1404
+ #### Common Failures
1405
+ - Component writes to field A but consumer reads field B
1406
+ - Runtime entrypoint still wired to a stub despite real implementation existing
1407
+ - Component returns empty results when dependencies are not injected by test setup
1408
+ - Build/config failure masked as a successful stub response
1409
+
1410
+ #### Severity Mapping
1411
+ - **Critical**: Runtime entrypoint returns stub/placeholder to end users
1412
+ - **High**: Component output not consumed by downstream (data silently lost)
1413
+ - **Medium**: Component requires caller injection instead of self-bootstrapping
1414
+ - **Low**: Interface contract undocumented but happens to work
1415
+
1416
+ **Decision Framework**:
1417
+ ```
1418
+ IF subtask has no downstream consumers AND no runtime entrypoint:
1419
+ → Skip (leaf component)
1420
+ ELSE:
1421
+ → Verify output reaches consumer through runtime path
1422
+ → Verify self-bootstrapping from config/storage
1423
+ ```
1424
+
1425
+ </Monitor_11D_Validation_v3_0>
1378
1426
 
1379
1427
 
1380
1428
  <Monitor_Severity_Matrix>
@@ -1395,6 +1443,7 @@ This table provides quick reference for severity classification per dimension. U
1395
1443
  | **8. External Deps** | Missing critical dependency documentation | Incomplete CRD/adapter docs | Missing version constraints | Minor config details |
1396
1444
  | **9. Documentation** | Contradicts tech-design/source of truth | Missing key fields/logic, wrong ownership | Minor inconsistencies | Formatting issues |
1397
1445
  | **10. Research** | N/A (rarely critical) | Complex problem + no research + wrong impl | Post-cutoff lib + outdated patterns | Missing citations only |
1446
+ | **11. Integration** | Runtime entrypoint returns stub to users | Output not consumed by downstream (data lost) | Requires caller injection instead of self-bootstrap | Interface contract undocumented |
1398
1447
 
1399
1448
  ### Severity Decision Tree
1400
1449
 
@@ -1553,8 +1602,8 @@ Do NOT invent issues to justify review effort. Empty `issues` array is valid.
1553
1602
  },
1554
1603
  "category": {
1555
1604
  "type": "string",
1556
- "enum": ["correctness", "security", "code-quality", "performance", "testability", "cli-tool", "maintainability", "external-deps", "documentation", "research"],
1557
- "description": "Maps to 10-dimension model: 1=correctness, 2=security, 3=code-quality, 4=performance, 5=testability, 6=cli-tool, 7=maintainability, 8=external-deps, 9=documentation, 10=research"
1605
+ "enum": ["correctness", "security", "code-quality", "performance", "testability", "cli-tool", "maintainability", "external-deps", "documentation", "research", "integration"],
1606
+ "description": "Maps to 11-dimension model: 1=correctness, 2=security, 3=code-quality, 4=performance, 5=testability, 6=cli-tool, 7=maintainability, 8=external-deps, 9=documentation, 10=research, 11=integration"
1558
1607
  },
1559
1608
  "title": {
1560
1609
  "type": "string",
@@ -1601,7 +1650,7 @@ Do NOT invent issues to justify review effort. Empty `issues` array is valid.
1601
1650
  "type": "array",
1602
1651
  "items": {
1603
1652
  "type": "string",
1604
- "enum": ["correctness", "security", "code-quality", "performance", "testability", "cli-tool", "maintainability", "external-deps", "documentation", "research"]
1653
+ "enum": ["correctness", "security", "code-quality", "performance", "testability", "cli-tool", "maintainability", "external-deps", "documentation", "research", "integration"]
1605
1654
  },
1606
1655
  "description": "Dimensions that passed completely"
1607
1656
  },
@@ -1609,7 +1658,7 @@ Do NOT invent issues to justify review effort. Empty `issues` array is valid.
1609
1658
  "type": "array",
1610
1659
  "items": {
1611
1660
  "type": "string",
1612
- "enum": ["correctness", "security", "code-quality", "performance", "testability", "cli-tool", "maintainability", "external-deps", "documentation", "research"]
1661
+ "enum": ["correctness", "security", "code-quality", "performance", "testability", "cli-tool", "maintainability", "external-deps", "documentation", "research", "integration"]
1613
1662
  },
1614
1663
  "description": "Dimensions with issues"
1615
1664
  },
@@ -1908,7 +1957,7 @@ ARRAY POPULATION:
1908
1957
  - Ensure: passed_checks ∩ failed_checks = ∅ (no overlap)
1909
1958
 
1910
1959
  SPECIAL CASES:
1911
- - If no issues found: all 10 categories go in passed_checks
1960
+ - If no issues found: all 11 categories go in passed_checks
1912
1961
  - If a dimension was skipped (large change): omit from both arrays
1913
1962
  ```
1914
1963
 
@@ -2016,6 +2065,7 @@ ELSE:
2016
2065
  | `external-deps` | Missing CRDs, undocumented dependencies | 8 |
2017
2066
  | `documentation` | Inconsistent with source, missing fields | 9 |
2018
2067
  | `research` | Missing research for unfamiliar patterns | 10 |
2068
+ | `integration` | Output not consumed downstream, stub in runtime | 11 |
2019
2069
 
2020
2070
  </Monitor_Decision_Rules>
2021
2071
 
@@ -2458,7 +2508,7 @@ def check_rate_limit(user_id, action, limit=100, window=3600):
2458
2508
 
2459
2509
  1. ✅ Did I use request_review for code implementations?
2460
2510
  2. ✅ Did I check for known issue patterns?
2461
- 3. ✅ Did I check all 10 validation dimensions systematically?
2511
+ 3. ✅ Did I check all 11 validation dimensions systematically?
2462
2512
  4. ✅ Did I verify documentation against source of truth (if applicable)?
2463
2513
  5. ✅ Are all issues specific with location and actionable suggestions?
2464
2514
  6. ✅ Is severity classification correct per guidelines?
@@ -278,12 +278,24 @@ Return **ONLY** valid JSON in this exact structure:
278
278
  - In that case: either add a FOUNDATION subtask to introduce a minimal test harness, or document the gap explicitly in risks/assumptions.
279
279
  **subtasks[].affected_files**: Precise file paths (NOT "backend", "frontend"); use [] if paths unknown
280
280
 
281
+ ### Integration & Runtime Bootstrapping Subtasks
282
+
283
+ Feature subtasks implement components in isolation. To ensure they work together in the real runtime, you MUST also create:
284
+
285
+ 1. **Integration subtask** (one per runtime entrypoint): Wires real implementations into the runtime surface, replacing any stubs/placeholders. AAG contract must name the entrypoint and verify end-to-end data flow through it.
286
+ - Depends on ALL feature subtasks it integrates.
287
+
288
+ 2. **Bootstrapping subtask** (when components need external data at runtime): Ensures each workflow loads its own dependencies from configuration or persistent storage rather than requiring callers to pre-populate them.
289
+
290
+ 3. **Interface contracts between subtasks**: When subtask A produces output consumed by subtask B, document the data contract in BOTH subtasks' validation criteria so neither side can silently break it.
291
+
281
292
  ### Subtask Ordering
282
293
 
283
294
  Subtasks should be ordered by dependency:
284
295
  1. Foundation subtasks (no dependencies) first
285
296
  2. Dependent subtasks after their prerequisites
286
- 3. Tests/docs can be parallel with implementation (same dependency level)
297
+ 3. Integration/wiring subtasks after ALL feature subtasks they integrate
298
+ 4. Tests/docs can be parallel with implementation (same dependency level)
287
299
 
288
300
  **CRITICAL**: If subtask B depends on subtask A, A must appear BEFORE B in the array.
289
301
 
@@ -529,6 +541,12 @@ When invoked with `mode: "re_decomposition"` from the orchestrator, you receive
529
541
  - [ ] Dependencies reference valid subtask IDs
530
542
  - [ ] Follows ordering constraint (dependencies before dependents)
531
543
 
544
+ **Integration & Wiring**:
545
+ - [ ] At least one integration subtask wires features into each runtime entrypoint
546
+ - [ ] Interface contracts documented when one subtask produces output consumed by another
547
+ - [ ] Bootstrapping subtask exists if components need data from disk/config at runtime
548
+ - [ ] No subtask silently assumes its output is consumed — explicit consumer named in VC
549
+
532
550
  **Dependency Validation** (CRITICAL):
533
551
  - [ ] **Circular dependency check**: Verify dependency graph is acyclic (A→B→C→A is INVALID)
534
552
  - [ ] **Mental topological sort**: Can all subtasks be executed in a valid order?