Skip to content

Harden MAP harness context gates#141

Merged
azalio merged 4 commits into
mainfrom
harden-map-harness-p0-p1
May 21, 2026
Merged

Harden MAP harness context gates#141
azalio merged 4 commits into
mainfrom
harden-map-harness-p0-p1

Conversation

@azalio
Copy link
Copy Markdown
Owner

@azalio azalio commented May 21, 2026

Summary

  • add template hygiene guardrails to keep cache/generated artifacts out of shipped MAP templates and package builds
  • add post-compact MAP re-prime context with workflow state, constraints, acceptance tags, and retry rejection reminders
  • inject current subtask hard constraints and validation tags before edit/write operations
  • require source-cited evidence for dismissal verdicts across review/check agents and skills

Validation

  • make check
  • python -m mapify_cli.skill_ir src/mapify_cli/templates/skills src/mapify_cli/templates/codex/skills
  • git diff --check

Copilot AI review requested due to automatic review settings May 21, 2026 19:29
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR hardens the MAP harness’ “context gates” by (1) keeping generated/cache artifacts out of shipped templates and installs, (2) re-priming essential workflow context after compaction, and (3) tightening evidence-first requirements for dismissal verdicts across MAP review/check agents and skills.

Changes:

  • Add template hygiene guardrails (build/package excludes, sync cleanup, installer ignores, and a regression test to prevent shipping generated artifacts).
  • Enhance workflow context injection and post-compaction re-prime context with hard constraints, acceptance/validation tags, and “source authority” reminders.
  • Enforce “evidence-first” dismissal verdict requirements across multiple agents/skills, with new contract tests.

Reviewed changes

Copilot reviewed 28 out of 28 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/test_workflow_context_injector.py Updates reminder truncation tests to use REMINDER_LIMIT and verifies constraints/tags/authority hints appear.
tests/test_template_sync.py Adds a hygiene test to prevent generated/cache artifacts from being tracked under shipped templates.
tests/test_skills.py Adds regression tests enforcing evidence-backed dismissal verdict contracts and source authority language.
tests/test_post_compact_context.py Adds tests for post-compaction re-prime context emission and silence when artifacts are absent.
tests/conftest.py Disables bytecode writing during tests to avoid generating __pycache__ / .pyc artifacts.
src/mapify_cli/templates/skills/map-review/SKILL.md Adds “source authority” guidance and evidence-first dismissal gate language.
src/mapify_cli/templates/skills/map-check/SKILL.md Adds “source authority” guidance and evidence-first dismissal gate language.
src/mapify_cli/templates/hooks/workflow-context-injector.py Raises reminder cap, injects hard constraints + acceptance tags, and adds source-authority hint.
src/mapify_cli/templates/hooks/post-compact-context.py Adds re-prime block after compaction with workflow state, constraints/tags, retry rejection summary, and authority reminder.
src/mapify_cli/templates/agents/predictor.md Adds evidence-first dismissal gate guidance to predictor agent prompt.
src/mapify_cli/templates/agents/monitor.md Adds evidence-first dismissal gate guidance to monitor agent prompt.
src/mapify_cli/templates/agents/final-verifier.md Adds source-authority + evidence-first dismissal requirements to final verifier instructions.
src/mapify_cli/templates/agents/evaluator.md Adds evidence-first dismissal gate requirement to evaluator instructions.
src/mapify_cli/templates/agents/documentation-reviewer.md Adds source-authority + evidence-first dismissal requirements for documentation verdicts.
src/mapify_cli/delivery/file_copier.py Adds copy-time ignore filter to prevent installing __pycache__/.pyc/.DS_Store from dirty template trees.
src/mapify_cli/delivery/codex_copier.py Extends codex template copier to skip __pycache__, .DS_Store, and .pyc/.pyo files.
scripts/sync-templates.sh Cleans generated artifacts during sync and excludes cache artifacts during rsync/copy.
pytest.ini Excludes slow tests by default; adds asyncio loop scope setting.
pyproject.toml Adds hatch build excludes for __pycache__, .pyc/.pyo, and .DS_Store.
.claude/skills/map-review/SKILL.md Mirrors shipped template updates for evidence-first dismissal and source authority rules.
.claude/skills/map-check/SKILL.md Mirrors shipped template updates for evidence-first dismissal and source authority rules.
.claude/hooks/workflow-context-injector.py Mirrors shipped template updates for reminder cap, constraints/tags, and source-authority hint.
.claude/hooks/post-compact-context.py Mirrors shipped template updates for post-compaction re-prime context.
.claude/agents/predictor.md Mirrors shipped template updates for evidence-first dismissal gate language.
.claude/agents/monitor.md Mirrors shipped template updates for evidence-first dismissal gate language.
.claude/agents/final-verifier.md Mirrors shipped template updates for source authority + evidence-first dismissal requirements.
.claude/agents/evaluator.md Mirrors shipped template updates for evidence-first dismissal gate language.
.claude/agents/documentation-reviewer.md Mirrors shipped template updates for source authority + evidence-first dismissal requirements.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pytest.ini
@@ -1,10 +1,11 @@
[pytest]
asyncio_default_fixture_loop_scope = function
Comment thread tests/test_template_sync.py Outdated
Comment on lines +64 to +68
project_root = templates_root.parents[2]
result = subprocess.run(
["git", "ls-files", "src/mapify_cli/templates"],
cwd=project_root,
capture_output=True,
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 36 out of 36 changed files in this pull request and generated 2 comments.

Comment thread tests/test_template_sync.py Outdated
Comment on lines +64 to +77
project_root = templates_root.parents[2]
result = subprocess.run(
["git", "ls-files", "src/mapify_cli/templates"],
cwd=project_root,
capture_output=True,
text=True,
check=True,
timeout=5,
)
offenders = [
Path(path).relative_to("src/mapify_cli/templates")
for path in result.stdout.splitlines()
if _is_disallowed_template_artifact(Path(path))
]
Comment thread pytest.ini
Comment on lines 1 to +7
[pytest]
asyncio_default_fixture_loop_scope = function
testpaths = tests
python_files = test_*.py
python_classes = Test*
python_functions = test_*
addopts = -v --tb=short --strict-markers
addopts = -v --tb=short --strict-markers -m "not slow"
@azalio azalio merged commit db29410 into main May 21, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants