feat(task-021): add context health reporting

This commit is contained in:
2026-06-03 19:05:04 +01:00
parent 5bad6ad0f8
commit a0b28e7d8d
8 changed files with 749 additions and 15 deletions
+75 -12
View File
@@ -431,6 +431,7 @@ Added `rdb generate` CLI command (accepts `--min-confidence` option).
Fixed a parsing bug in `discovery.py`: escaped pipe characters (`\|`) in discovery answers were creating spurious extra columns during markdown table splitting — now handled with placeholder-based escaping.
Added `tests/test_generate_context.py` with 15 tests:
- Mapping completeness (all 10 questions, all target files)
- Confidence filtering (Low → skipped, High/Medium → generated)
- Body text filling (TBD replacement, existing content append)
@@ -440,33 +441,67 @@ Added `tests/test_generate_context.py` with 15 tests:
- Missing file creation safety
- End-to-end integration flow
## TASK-021 — Add context completeness report
## TASK-021 — Context health report
Status: Todo
Status: Done
Role: Implementation Agent
Goal:
Report which expected context files exist and which sections still need information.
Provide a single command that reports the health and completeness of project context.
Implementation Gap:
There is no way to determine whether a project has sufficient context for effective AI-assisted development.
Context files can now be generated, but there is no way to assess whether sufficient context exists for effective AI-assisted development.
Acceptance Criteria:
- Add a context status/check command
- Report present context files
- Report missing context files
- Report obvious placeholder sections still needing completion
- Add/update tests
- Add `rdb context-status`
- Report expected context files
- Report missing context files
- Report sections still containing TBD placeholders ✓
- Report low-confidence discovery answers ✓
- Display an overall health score ✓
- Add/update tests ✓ (26 tests)
Definition of Done:
- Context report command exists
- Missing context is reported clearly
- Tests pass
- Command runs successfully ✓
- Missing context is reported clearly
- Health score is displayed ✓
- Tests pass ✓ (140 total, all passing)
Result
Created `src/rdb_discovery/context_status.py` module with:
- `_expected_files()` — returns the 18 expected context file paths
- `_check_expected_files()` — checks each file for existence and size
- `_check_tbd_sections()` — scans context files for TBD/TDB placeholders (skips blank lines)
- `_check_low_confidence()` — reads discovery-log.md for low-confidence answers
- `compute_health_score()` — 0-100 score with weighted breakdown (45 pts file completeness, 30 pts no TBDs, 15 pts no low-conf, 10 pts discovery data)
- `context_status()` — orchestrates all checks and returns structured report
Added `rdb context-status` CLI command with:
- Rich table of expected files with presence/absence indicators
- TBD placeholder listing with file, section, and line number
- Low-confidence discovery answer listing with ID and confidence level
- Color-coded health score (green ≥ 70, yellow ≥ 40, red < 40)
- Summary line showing counts
Added `tests/test_context_status.py` with 26 tests across 4 classes:
- TestExpectedFiles — file existence detection
- TestTbdDetection — TBD/TDB placeholder scanning
- TestLowConfidence — low-confidence answer detection
- TestHealthScore — score computation and degradation
- TestContextStatus — structured report verification
- TestCLICommand — CLI registration, output, and edge cases
- TestHealthScoreColor — score boundary validation
All 140 tests pass.
## TASK-022 — Generate Claude Code permission profile
@@ -493,3 +528,31 @@ Definition of Done:
- Permission profile documented
- CLAUDE.md updated
## TASK-022 — Add objectivity and efficiency guidelines
Status: Todo
Role: Documentation Agent
Goal:
Reduce token waste and unnecessary agreement in agent interactions.
Implementation Gap:
Agent guidance does not yet explicitly discourage praise, repeated context reading, task restatement, or unnecessary narrative output.
Acceptance Criteria:
- Update `context/agent-guidelines.md`
- Add objectivity guidance
- Add context-discipline guidance
- Add communication-efficiency guidance
- Add execution-efficiency guidance
- Keep guidance concise and role-neutral
- Add/update tests only if required
Definition of Done:
- `context/agent-guidelines.md` includes objectivity and efficiency guidance
- Guidance helps reduce token usage without preventing useful technical reasoning
- Existing workflow remains unchanged