Skip to content

Commit ae466c5

Browse files
committed
docs(truth): reconcile README uncalled claims and invalid guide surfaces
Execute the top-ranked follow-ups from the origins/dormant-surfaces refresh (G-P2-7). Every claim was re-verified against code before editing. README (documented-but-uncalled -> match code): - Failure warnings are surfaced on demand via `teaagent memory failures`, not auto-injected (`get_failure_warnings` has no caller). - Pinned-file context refresh is TUI-session only (`FileWatcher` is TUI-only). - Removed the false pin-count prompt indicator (`_prompt()` renders no pin count). - Validation is static analysis (ruff/mypy/tsc/eslint), not LSP, and runs post-run via `--validate` (it does not gate commits). - RAG archival is a helper (`ContextBus.archive_to_rag`), not auto-invoked. Guides (invalid CLI/API -> real surfaces): - `audit export --audit-log <run_id>` -> `audit export <run_id>` (positional). - `audit verify --audit-log <file>` -> `audit verify --root .`. - Replaced nonexistent `audit analyze` / `audit archive` with real commands (`audit list`/`audit tail`/`audit prune`) in the security onboarding guide. - Rewrote the hooks integration section to the real API: build a `HookRegistry`, `register_pre_hook`/`register_post_hook` with real signatures, attach via `ChatAgentConfig(hook_registry=...)`; corrected the event table to `HookEvent` names (PreToolUse/PostToolUse/...). D7 (stale 650->663 acceptance count in the constitution-tier harness-first doc) is deferred to Human Review, as its own governance header requires. Action: G-P2-7 Roadmap-Status: unchanged Constraint: docs-only truth corrections; no code/behavior change; each claim verified against code before editing; constitution-tier D7 left for Human Review Tested: validate_docs_consistency.py passes (29/29 risk, 21/21 ticket, consistency passed); command-snippet + docs inventories regenerated; audit/agent CLI signatures and hooks.py API verified via --help and source Confidence: high
1 parent f144d63 commit ae466c5

12 files changed

Lines changed: 77 additions & 62 deletions

README.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -130,23 +130,22 @@ TeaAgent includes persistent memory features to learn from past mistakes and syn
130130

131131
**Failure Experience Loop:**
132132
- Background tasks that fail automatically create "failure cards" capturing error context
133-
- Future similar tasks automatically receive warnings about past failures
133+
- Review those failure cards before retrying similar work via `teaagent memory failures` (surfaced on demand, not auto-injected into new runs)
134134
- Automated invalidation rules prevent memory corruption (file signature changes, test refactors, dependency updates)
135135
- Commands: `teaagent memory failures` (list), `teaagent memory failures auto-invalidate` (apply rules), `teaagent memory failures prune` (cleanup)
136136

137137
**Live Context Anchors:**
138138
- Pin files with `/pin <file>` to watch for changes in your IDE
139-
- CLI automatically refreshes context when you save pinned files
139+
- The interactive TUI refreshes context when you save pinned files (the file watch runs in the TUI session)
140140
- Commands: `/pin <file>`, `/unpin <file>`, `/pinned` (list)
141-
- Visual indicator in prompt shows pinned file count (e.g., `teaagent📌2>`)
142141

143142
### 8. Self-Healing Validation (Beta)
144143

145-
LSP/static analysis validation is integrated with the agent runner and workflow engine:
144+
Static analysis validation (ruff, mypy, tsc, eslint) is integrated with the agent runner and workflow engine:
146145

147146
**Validation Tools:**
148147
- Auto-detects available tools (ruff, mypy, tsc, eslint)
149-
- Validates code before committing changes
148+
- Runs the configured validation profile after an agent run (post-run; it does not gate commits)
150149
- Supports Python, TypeScript, and JavaScript projects
151150
- Enable with `--validate` on `agent run` or via workflow self-healing steps
152151

@@ -177,7 +176,7 @@ Self-healing validation is described in [section 8](#8-self-healing-validation-b
177176
- Real-time Delta sharing between parallel agents via WAL-mode SQLite (per-thread connections; see `docs/context-bus-and-federated-sync.md`)
178177
- Delta cards for code changes, discoveries, errors, and context updates
179178
- Filtered subscriptions by agent, type, and timestamp
180-
- Automatic RAG archive after workflow completion
179+
- RAG archival helper (`ContextBus.archive_to_rag`) is available for callers; it is not auto-invoked after runs
181180

182181
**Evolutionary Prompt Tuning:**
183182
- Performance-based agent prompt evolution

docs/api/integration-guide.md

Lines changed: 33 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -283,32 +283,47 @@ from teaagent.cli._handlers.my_command import handle_my_command
283283

284284
## Registering Hook Handlers
285285

286-
Hooks fire at key points in the agent lifecycle. Register with `hook_registry`:
286+
Hooks fire at key points in the agent lifecycle. Build a `HookRegistry`, register
287+
handlers, and attach it to your agent config:
287288

288289
```python
289-
from teaagent.hooks import hook_registry
290+
from teaagent.hooks import HookRegistry, HookError
290291

291-
@hook_registry.register('before_tool_call')
292-
def my_before_hook(context: dict) -> None:
293-
print(f"About to call: {context['tool_name']}")
292+
registry = HookRegistry()
294293

295-
@hook_registry.register('after_tool_call')
296-
def my_after_hook(context: dict) -> None:
297-
print(f"Tool returned: {context['result']}")
294+
def my_pre_hook(tool_name: str, arguments: dict) -> dict | None:
295+
# Return modified arguments, None to allow unchanged, or raise HookError to veto.
296+
print(f"About to call: {tool_name}")
297+
return None
298+
299+
def my_post_hook(tool_name: str, arguments: dict, result: dict) -> dict | None:
300+
# Return a modified result, or None to keep the original.
301+
print(f"Tool returned: {result}")
302+
return None
303+
304+
registry.register_pre_hook(my_pre_hook)
305+
registry.register_post_hook(my_post_hook)
298306
```
299307

308+
Attach the registry when you construct the agent —
309+
`ChatAgentConfig(hook_registry=registry)` — and it is wired into the tool registry at
310+
run start.
311+
300312
### Available hook events
301313

302-
| Event | Context keys | Description |
303-
|-------|-------------|-------------|
304-
| `before_tool_call` | `tool_name`, `call_id`, `arguments` | Before dispatching a tool |
305-
| `after_tool_call` | `tool_name`, `call_id`, `result`, `elapsed_ms` | After tool returns |
306-
| `on_tool_error` | `tool_name`, `call_id`, `error` | When tool raises |
307-
| `before_model_call` | `messages`, `model`, `iteration` | Before sending to LLM |
308-
| `after_model_call` | `response`, `cost_cents`, `tokens` | After LLM responds |
309-
| `on_run_start` | `run_id`, `task`, `config` | Run begins |
310-
| `on_run_end` | `run_id`, `result` | Run completes |
311-
| `on_approval_request` | `approval_request` | Approval prompt triggered |
314+
The lifecycle is Claude Code-compatible (`teaagent.hooks.HookEvent`); register each via
315+
the matching `HookRegistry` method:
316+
317+
| Event (`HookEvent`) | Register with | Handler signature |
318+
|---------------------|---------------|-------------------|
319+
| `SessionStart` | `register_session_start_hook` | `(session_id, context)` |
320+
| `UserPromptSubmit` | `register_user_prompt_submit_hook` | `(session_id, context)` |
321+
| `PreToolUse` | `register_pre_hook` | `(tool_name, arguments)` -> modified args or None; raise `HookError` to veto |
322+
| `PostToolUse` | `register_post_hook` | `(tool_name, arguments, result)` -> modified result or None |
323+
| `PreCompact` | `register_pre_compact_hook` | `(context)` -> modified context or None |
324+
| `Stop` | `register_stop_hook` | `(session_id, context)` |
325+
| `SubagentStop` | `register_subagent_stop_hook` | `(session_id, context)` |
326+
| `SessionEnd` | `register_session_end_hook` | `(session_id, context)` |
312327

313328
---
314329

docs/cli.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -924,7 +924,7 @@ teaagent agent show <run_id> --root /path/to/repo
924924
Export a compliance audit bundle with hash-chain verification for a completed run:
925925

926926
```bash
927-
teaagent audit export --audit-log <run_id> --output compliance.json
927+
teaagent audit export <run_id> --output compliance.json
928928
```
929929

930930
The compliance bundle includes a signed digest of all audit events, chain verification

docs/generated/command-snippet-inventory.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,19 @@ Regenerate: `python3 scripts/generate_command_snippet_inventory.py`
1010
| --- | --- | --- | --- |
1111
| `teaagent --config .teaagent/config.json model smoke gpt` | `docs/cli.md:31` (0de72469) | manual | Alternate config path smoke |
1212
| `teaagent --help` | `docs/cli.md:25` (d09b09bd) | manual | CLI help smoke |
13-
| `teaagent agent daily gpt "Summarize the tests" --permission-mode read-only` | `README.md:367` (05bc391c) | smoke | tests/acceptance/test_daily_cli.py |
13+
| `teaagent agent daily gpt "Summarize the tests" --permission-mode read-only` | `README.md:366` (05bc391c) | smoke | tests/acceptance/test_daily_cli.py |
1414
| `teaagent agent daily gpt "map subsystem boundaries" --context-profile deep` | `docs/USAGE.md:371` (3ac367a2) | smoke | tests/acceptance/test_daily_cli.py |
1515
| `teaagent agent daily gpt "plan test fix" --context-profile balanced` | `docs/USAGE.md:370` (291ea4fe) | smoke | tests/acceptance/test_daily_cli.py |
1616
| `teaagent agent daily gpt "review auth flow" --context-profile lean` | `docs/USAGE.md:369` (efe69395) | smoke | tests/acceptance/test_daily_cli.py |
1717
| `teaagent agent daily gpt "what I want to do today" --permission-mode read-only --root .` | `docs/USAGE.md:330` (41b8128d) | smoke | tests/acceptance/test_daily_cli.py |
1818
| `teaagent agent preflight gpt "fix tests/test_foo.py" --route-model` | `docs/USAGE.md:372` (d6336bc5) | manual | Preflight smoke with configured provider |
19-
| `teaagent agent run gpt "Analyze this codebase" --permission-mode read-only` | `README.md:336` (a8e6903c) | manual | Agent run smoke with configured provider |
20-
| `teaagent agent run gpt "Improve this project" --clarify` | `README.md:361` (d2ccc65c) | manual | Agent run smoke with configured provider |
21-
| `teaagent agent run gpt "Inspect this repo and summarize the test suite"` | `README.md:355` (528345e2) | manual | Agent run smoke with configured provider |
22-
| `teaagent agent run gpt "Update README" --permission-mode workspace-write --route-model` | `README.md:358` (5ef6ae13) | manual | Agent run smoke with configured provider |
19+
| `teaagent agent run gpt "Analyze this codebase" --permission-mode read-only` | `README.md:335` (a8e6903c) | manual | Agent run smoke with configured provider |
20+
| `teaagent agent run gpt "Improve this project" --clarify` | `README.md:360` (d2ccc65c) | manual | Agent run smoke with configured provider |
21+
| `teaagent agent run gpt "Inspect this repo and summarize the test suite"` | `README.md:354` (528345e2) | manual | Agent run smoke with configured provider |
22+
| `teaagent agent run gpt "Update README" --permission-mode workspace-write --route-model` | `README.md:357` (5ef6ae13) | manual | Agent run smoke with configured provider |
2323
| `teaagent agent run gpt "fix tests/test_foo.py" --permission-mode workspace-write` | `docs/USAGE.md:373` (76f03456) | manual | Agent run smoke with configured provider |
24-
| `teaagent agent run gpt "inspect src/app.py" --code-analysis` | `README.md:378` (153bc54d) | manual | Agent run smoke with configured provider |
25-
| `teaagent agent runs` | `README.md:364` (0493189b) | manual | Run list smoke |
24+
| `teaagent agent run gpt "inspect src/app.py" --code-analysis` | `README.md:377` (153bc54d) | manual | Agent run smoke with configured provider |
25+
| `teaagent agent runs` | `README.md:363` (0493189b) | manual | Run list smoke |
2626
| `teaagent agent undo --last --root .` | `docs/USAGE.md:34` (6dc512e7) | manual | Undo smoke after mutating run |
2727
| `teaagent approval check workspace_write_file --path src/foo.py --root .` | `docs/USAGE.md:67` (a85952bb) | manual | Scoped grant check smoke |
2828
| `teaagent approval grant workspace_run_shell_mutate --command-prefix 'pytest ' --root .` | `docs/USAGE.md:65` (f0759ae5) | manual | Scoped grant smoke in prompt mode |

docs/generated/docs-aging-dashboard.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Regenerate: `python3 scripts/report_docs_aging.py`
2121

2222
| Document | Status | Last reviewed | File mtime | Notes |
2323
| --- | --- | --- | --- | --- |
24-
| `docs/cli.md` | stale_by_mtime | 2026-06-06 | 2026-06-21 | Missing owner banner; File modified after last reviewed date |
24+
| `docs/cli.md` | stale_by_mtime | 2026-06-06 | 2026-07-01 | Missing owner banner; File modified after last reviewed date |
2525

2626
### daily-driver
2727

@@ -49,7 +49,7 @@ Regenerate: `python3 scripts/report_docs_aging.py`
4949

5050
| Document | Status | Last reviewed | File mtime | Notes |
5151
| --- | --- | --- | --- | --- |
52-
| `README.md` | stale_by_mtime | 2026-06-17 | 2026-06-21 | Missing owner banner; File modified after last reviewed date |
52+
| `README.md` | stale_by_mtime | 2026-06-17 | 2026-07-01 | Missing owner banner; File modified after last reviewed date |
5353

5454
### release
5555

docs/generated/docs-inventory.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ Do not edit this file manually — regenerate instead.
164164
| `api/cli-api.md` | working | 12872 | `024709a9633a` |
165165
| `api/daily-driver-command-contracts-2026-06-02.md` | archive | 1174 | `867a4267cd7e` |
166166
| `api/data-formats.md` | working | 9607 | `3dbcae1c1785` |
167-
| `api/integration-guide.md` | working | 13127 | `9b0d324467f8` |
167+
| `api/integration-guide.md` | working | 13822 | `38ae10c08466` |
168168
| `api/mcp-api.md` | working | 6766 | `16dc0ff0b9e6` |
169169
| `api/python-api.md` | working | 18652 | `c74af18ca68a` |
170170
| `api/README.md` | working | 5308 | `4993082e1bf3` |
@@ -193,7 +193,7 @@ Do not edit this file manually — regenerate instead.
193193
| `archive/INDEX.md` | working | 8774 | `1efa1af575f5` |
194194
| `audit-events.md` | working | 2376 | `b83066076fba` |
195195
| `backlog-priority.md` | working | 32338 | `4fcd06c4782f` |
196-
| `cli.md` | working | 36528 | `88e79b022406` |
196+
| `cli.md` | working | 36516 | `c38d3a5e9907` |
197197
| `cloud-deployment.md` | working | 9431 | `50f6461a2077` |
198198
| `context-bus-and-federated-sync.md` | working | 1564 | `2dde6eed4bf8` |
199199
| `daily-driver-current-status.md` | working | 17475 | `3baeefb535f9` |
@@ -239,8 +239,8 @@ Do not edit this file manually — regenerate instead.
239239
| `DOCUMENTATION_STRATEGY.md` | working | 8211 | `aecb1e6ce6c3` |
240240
| `error-reference.md` | working | 4897 | `067448aba6f1` |
241241
| `gateway-oauth-tenants.md` | working | 1818 | `0ff9c7df4652` |
242-
| `generated/command-snippet-inventory.md` | working | 8128 | `f11e933dfa4d` |
243-
| `generated/docs-aging-dashboard.md` | working | 4995 | `baa894c82548` |
242+
| `generated/command-snippet-inventory.md` | working | 8128 | `e6e24d7fb469` |
243+
| `generated/docs-aging-dashboard.md` | working | 4995 | `6b1cc99575f5` |
244244
| `generated/release-docs-evidence.md` | working | 2517 | `e28e92734209` |
245245
| `governance-compliance.md` | constitution | 1645 | `d7665f2f7864` |
246246
| `governance/code-review-checklist.md` | working | 4379 | `f580da208c75` |
@@ -270,7 +270,7 @@ Do not edit this file manually — regenerate instead.
270270
| `governance/security-standards.md` | working | 7747 | `fcdf36df8285` |
271271
| `governance/standards.md` | working | 9573 | `bbf0fa146cb2` |
272272
| `governance/testing-standards.md` | working | 5818 | `15a44e1078db` |
273-
| `governance/trust-and-audit-whitepaper.md` | working | 4920 | `641758c5382d` |
273+
| `governance/trust-and-audit-whitepaper.md` | working | 4908 | `111a0b2046a8` |
274274
| `graphqlite-production.md` | working | 5127 | `6426aec5caf9` |
275275
| `graphqlite.md` | working | 1207 | `77e3f89f30c7` |
276276
| `guides/agent-mode-recipes-2026-06-02.md` | archive | 1421 | `a6802fd18360` |
@@ -280,9 +280,9 @@ Do not edit this file manually — regenerate instead.
280280
| `guides/chat-surface-semantics.md` | working | 2690 | `24d0ec17e395` |
281281
| `guides/daily-driver-command-cookbook-2026-06-02.md` | archive | 1943 | `d9155cd0c744` |
282282
| `guides/daily-driver-guide-index-2026-06-02.md` | archive | 1378 | `441f42fec252` |
283-
| `guides/getting-started-security-reviewer.md` | working | 2093 | `686b399abc5c` |
283+
| `guides/getting-started-security-reviewer.md` | working | 2081 | `815983cebe06` |
284284
| `guides/getting-started-solo-cli.md` | working | 1560 | `943cf2c8eda2` |
285-
| `guides/getting-started-team-operator.md` | working | 1771 | `39b7d7bba818` |
285+
| `guides/getting-started-team-operator.md` | working | 1759 | `a4f6a05b934d` |
286286
| `guides/getting-started-tool-plugin-author.md` | working | 1828 | `bfa469d6c758` |
287287
| `guides/hybrid-approval-queue-configuration.md` | working | 20139 | `9b9af38453ef` |
288288
| `guides/integration-guide.md` | working | 14532 | `008880ed29f0` |
@@ -407,8 +407,8 @@ Do not edit this file manually — regenerate instead.
407407
| `modules/workspace_tools/spec.md` | working | 2155 | `886b45749b93` |
408408
| `multi-sig-wan-deployment.md` | working | 1585 | `0c35b3606dc9` |
409409
| `observability-logging.md` | working | 3029 | `591ed74fc38c` |
410-
| `onboarding-ml-researchers.md` | working | 10059 | `ebaeeb788ee2` |
411-
| `onboarding-security-engineers.md` | working | 8152 | `dc8bfad3250c` |
410+
| `onboarding-ml-researchers.md` | working | 10029 | `356f5cb881e3` |
411+
| `onboarding-security-engineers.md` | working | 8190 | `e72254a0c125` |
412412
| `operator-trust-model.md` | working | 3439 | `2077a669d958` |
413413
| `ops/backup-and-recovery.md` | working | 8644 | `0d02d348ab2b` |
414414
| `ops/configuration-reference.md` | working | 9722 | `04d9ac3d2158` |
@@ -524,7 +524,7 @@ Do not edit this file manually — regenerate instead.
524524
| `retrospective/03-architecture-quality.md` | working | 27525 | `fd28fdd70665` |
525525
| `retrospective/04-ux-usability.md` | working | 26253 | `a9350bc35c4b` |
526526
| `retrospective/05-compliance-matrix.md` | working | 8285 | `cd2568b5eddb` |
527-
| `retrospective/06-action-register.md` | working | 34588 | `4c105e153ca3` |
527+
| `retrospective/06-action-register.md` | working | 35782 | `a90fb37388cb` |
528528
| `retrospective/automation-plan.md` | working | 18716 | `0e0027c4b1c5` |
529529
| `retrospective/README.md` | working | 8718 | `d93f2a71f6b3` |
530530
| `retrospective/review-system.md` | working | 15180 | `61db6643e4aa` |

docs/governance/trust-and-audit-whitepaper.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ teaagent doctor config-lint --root .
7979
teaagent audit verify --root .
8080

8181
# Compliance bundle export (signed digest)
82-
teaagent audit export --audit-log <run_id> --output /tmp/bundle.json --root .
82+
teaagent audit export <run_id> --output /tmp/bundle.json --root .
8383

8484
# Observability on a completed run
8585
teaagent audit tail <run_id> --human --limit 20 --root .

docs/guides/getting-started-security-reviewer.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Enterprise NIST mapping detail: [Security Whitepaper](../security-whitepaper.md)
1717

1818
1. Sample run audit log: `.teaagent/runs/<run_id>.jsonl`
1919
2. Chain verification output: `teaagent audit verify --root .`
20-
3. Compliance export: `teaagent audit export --audit-log <run_id> --output bundle.json`
20+
3. Compliance export: `teaagent audit export <run_id> --output bundle.json`
2121
4. Config lint: `teaagent doctor config-lint --root .`
2222
5. Permission policy: `teaagent approval list --root .`
2323

docs/guides/getting-started-team-operator.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Review `doctor config-lint` findings before enabling destructive modes in CI.
3535
```bash
3636
teaagent approval pending --human --root .
3737
teaagent audit verify --root .
38-
teaagent audit export --audit-log <run_id> --output evidence.json --root .
38+
teaagent audit export <run_id> --output evidence.json --root .
3939
teaagent doctor config-lint --root .
4040
```
4141

docs/onboarding-ml-researchers.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ teaagent run "Train model and log metrics" \
170170
171171
**Reproducibility checks:**
172172
```bash
173-
teaagent audit verify --audit-log experiment-001-audit.jsonl
173+
teaagent audit verify --root .
174174
```
175175
176176
## Best Practices for ML Research

0 commit comments

Comments
 (0)