Skip to content

feat: AI-assisted assertion mapping with agent-level evaluation - #59

Merged
jflowers merged 1 commit into
unbound-force:mainfrom
jflowers:ai-assertion-mapping
Mar 15, 2026
Merged

jflowers merged 1 commit into
unbound-force:mainfrom
jflowers:ai-assertion-mapping

Conversation

@jflowers

Copy link
Copy Markdown
Collaborator

Summary

  • Add AIMapperFunc callback as a 5th mapping pass for structurally disconnected assertions
  • Gaze-reporter agent prompt updated to evaluate unmapped assertions via source file reading
  • Mapping accuracy infrastructure: 86.4% mechanical + AI fallback for the remaining ~14%
  • Scaffold cleanup: remove review-council.md (tracked by OpenCode directly)
  • Constitution v1.3.0: review council gate as PR prerequisite

AI Assertion Mapping

The assertion mapping pipeline now has 5 passes:

Pass Confidence What
Direct identity 75 Variable types.Object matches traced effect
Helper bridge 70 Helper param -> caller arg resolution
Indirect root 65 Selector/index unwinding to root ident
Inline call 60 Target called inline in assertion expr
AI fallback 50 Semantic evaluation by AI model

The AI pass is opt-in via quality.Options.AIMapperFunc. When nil (default), behavior is identical to before.

Library API: AIMapperContext, BuildAIMapperPrompt, ParseAIMapperResponse -- everything needed for callers to wire any AI backend.

Agent-level: The gaze-reporter agent prompt now includes "Unmapped Assertion Evaluation" -- when running /gaze, the agent reads source files for unmapped assertions and evaluates semantic relationships directly.

Review Council

Two iterations of the 4-reviewer council. All HIGH/MEDIUM findings addressed:

  • Threaded opts.Stderr through MapAssertionsToEffects (no more os.Stderr global)
  • Fixed closed emoji vocabulary violation (replaced non-vocabulary emoji)
  • Added direct confidence-50 assertion test
  • Added stderr warning capture test for AI mapper errors
  • Fixed ParseAIMapperResponse non-deterministic multi-ID search
  • Updated scaffold test comments/names for 7->6 file count
  • Used typed constant instead of string literal in test

Also includes

  • Scaffold: removed review-council.md from embedded assets (user requested; tracked by OpenCode directly)
  • Constitution v1.3.0: review council gate as PR prerequisite
  • AGENTS.md: review council as PR prerequisite with workflow steps
  • 6 openspec archives moved from active to archive

Partially addresses #6

@jflowers jflowers added this to the v1.4.0 milestone Mar 15, 2026
Add AIMapperFunc callback to quality.Options as a 5th mapping pass
for assertions that all mechanical passes (direct identity, indirect
root, helper bridge, inline call) fail to map. AI mappings are
assigned confidence 50 (lower than all mechanical passes).

Library API:
- AIMapperContext struct with assertion source, test body, target
  function, and side effects
- BuildAIMapperPrompt: structured prompt for any AI backend
- ParseAIMapperResponse: extract effect ID from AI response
- tryAIMapping: orchestrates context building, AI call, validation
- Variadic parameter on MapAssertionsToEffects for backward compat
- 7 tests (match, no-match, error, nil, context, prompt, parser)

Agent-level mapping:
- gaze-reporter prompt updated with 'Unmapped Assertion Evaluation'
  section — agent reads source files for unmapped assertions and
  evaluates semantic relationships during /gaze command execution
- All 3 prompt copies synced (scaffold, .opencode, aireport)

Also includes:
- Remove review-council.md from scaffold (tracked by OpenCode)
- Constitution v1.3.0: review council gate as PR prerequisite
- AGENTS.md: review council as PR prerequisite section
- Archive 6 completed openspec changes

Partially addresses unbound-force#6
@jflowers
jflowers force-pushed the ai-assertion-mapping branch from ce1b6ff to b437cfc Compare March 15, 2026 23:02
@jflowers
jflowers merged commit 583cc2b into unbound-force:main Mar 15, 2026
5 checks passed
@jflowers
jflowers deleted the ai-assertion-mapping branch November 15, 2026 21:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

1 participant