refactor(agents): migrate .agent/ planning tree to .agents/

Standardize on the .agents/ directory (shared with project skills):
phases/, user_stories/, reports/, screenshots/, validate.sh, and
phase-sessions/ + pipeline.log all move to .agents/ (git mv preserves
history; runtime artifacts move alongside).

Updates every reference in AGENTS.md, README.md, .gitignore, app
docstrings, and test story headers. Historical KB content in data/
and the runtime pipeline.log transcript are left untouched.
This commit is contained in:
2026-09-05 10:57:07 -04:00
parent 766702c750
commit dbf2af26c6
1118 changed files with 664 additions and 664 deletions
@@ -0,0 +1,12 @@
Everything is verified green — no defects found, no fixes needed. Final report:
**Phase 44 — Markdown tables (final verification pass)**
- Verified table-protection pass in `frontend/assets/markdown.js` (fences → tables → escape order, escape-first cells, `\u0000TABLEn\u0000` restore in step 4), `.md-table`/`.md-table-wrap` palette CSS (incl. `min-width: max-content` so the wrap is the real scroller), `TABLE_TRIGGER`/`TABLE_ANSWER` in `mock_llm.py` (XSS probe + wide 5-col table), fixture `homelab/tables.md`, unit pins in `tests/unit/test_markdown_tables.py` (incl. node-driven behavior checks).
- Tests: `uv run pytest -p no:warnings --no-cov` → **738 passed** (exit 0); `uv run pytest --cov=app` → **TOTAL 99%** (>90%, unchanged — frontend-only).
- Lint: `uv run ruff check .` → "All checks passed!"; `uv run pyright` → "0 errors, 0 warnings, 0 informations".
- E2E (DB up, isolated): `uv run pytest tests/e2e/test_markdown_tables.py -v --no-cov` → **6 passed** (chat table shape, wide-table scroll w/o page overflow, XSS inert, viewer modal table, fence-wins, lone pipe stays text).
- Regression E2E (isolated): `test_chat_rag.py` 3 passed, `test_document_viewer.py` 7 passed, `test_document_summaries.py` 2 passed, `test_smoke.py` 3 passed.
- Commit: `bc70ce3 feat(chat): render markdown tables in answers, viewer, and thinking` — single, unsigned (`--no-gpg-sign`), HEAD; phase dir already in `.agents/phases/complete/44_markdown_tables/`.
- Completion criteria: all 9 checked ✅ (table shape, wide scroll, XSS/fence/lone-pipe, viewer table, full suite + coverage, story E2E, 4 regression suites, lint, commit + phase move).
- No deviations; uncommitted `.agents/` phase-file moves in `git status` are harness bookkeeping, left untouched per rules.
- Next pending phase: **`45_agent_unlimited_tools`**.
@@ -0,0 +1,60 @@
........................................................................ [ 9%]
........................................................................ [ 19%]
........................................................................ [ 29%]
........................................................................ [ 39%]
........................................................................ [ 48%]
........................................................................ [ 58%]
........................................................................ [ 68%]
........................................................................ [ 78%]
........................................................................ [ 87%]
........................................................................ [ 97%]
.................. [100%]
=============================== warnings summary ===============================
.venv/lib/python3.13/site-packages/fastapi/testclient.py:1
/var/home/ducoterra/Projects/Personal/brain_of_reese/.venv/lib/python3.13/site-packages/fastapi/testclient.py:1: StarletteDeprecationWarning: Using `httpx` with `starlette.testclient` is deprecated; install `httpx2` instead.
from starlette.testclient import TestClient as TestClient # noqa
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
================================ tests coverage ================================
_______________ coverage: platform linux, python 3.13.13-final-0 _______________
Name Stmts Miss Cover
--------------------------------------------
app/__init__.py 1 0 100%
app/api/__init__.py 0 0 100%
app/api/auth.py 22 0 100%
app/api/chat.py 122 0 100%
app/api/config.py 7 0 100%
app/api/docs.py 23 0 100%
app/api/git_sources.py 66 0 100%
app/api/health.py 10 0 100%
app/api/steering.py 42 0 100%
app/api/suggestions.py 8 0 100%
app/api/sync.py 81 0 100%
app/config.py 66 0 100%
app/core/__init__.py 0 0 100%
app/core/auth.py 20 0 100%
app/core/caching.py 92 0 100%
app/core/debugging.py 29 2 93%
app/core/logging.py 13 0 100%
app/db.py 21 0 100%
app/main.py 44 0 100%
app/models.py 60 0 100%
app/rag/__init__.py 0 0 100%
app/rag/agent.py 81 0 100%
app/rag/chunker.py 206 4 98%
app/rag/git_sources.py 14 0 100%
app/rag/importer.py 173 3 98%
app/rag/llm.py 186 0 100%
app/rag/overview.py 71 0 100%
app/rag/prompts.py 65 0 100%
app/rag/retriever.py 94 3 97%
app/rag/suggestions.py 27 0 100%
app/rag/summarizer.py 24 0 100%
app/schemas.py 99 0 100%
--------------------------------------------
TOTAL 1767 12 99%
coverage gate: app/ 99% (>90%) OK
All checks passed!
0 errors, 0 warnings, 0 informations
validation OK
@@ -0,0 +1,18 @@
All green. Task complete.
**Report — phase 44, task 01 (table renderer + styles)**
Implemented:
- `frontend/assets/markdown.js`: table-protection pass between fence and escape passes (fences win); line-oriented detection (`|` line + separator `^\s*:?-+:?\s*$` + `|` body); cells escape-first through the same factored inline chain as the whole-text path; exact `<div class="md-table-wrap"><table class="md-table">` assembly with `th scope="col"`, padded/truncated ragged rows, alignment colons parsed-but-ignored; `\u0000TABLEn\u0000` placeholder restored alongside CODE in step 4; header comment updated.
- `frontend/assets/styles.css`: unscoped `.md-table-wrap { overflow-x: auto }` scroller, `.md-table` collapse/100%/0.9rem, `--line` borders + 0.4/0.6rem padding + left/top cells, thead `--ink` on `--surface` (14.5:1, no brand) — serves bubble, thinking, and viewer; reduced-motion consistency noted.
- `tests/unit/test_markdown_tables.py` (new, 13 tests): house-style source pins (pass order, escape-first cells, output markers, restore step, CSS rules) + node behavioral check of story AC shapes 1–4.
Verification:
- `uv run pytest --cov=app --cov-report=term-missing` → 738 passed, TOTAL **99%** (>90% gate)
- `uv run ruff check . && uv run pyright` → clean / 0 errors
- `uv run pytest tests/e2e/test_chat_rag.py -v --no-cov` → 3/3 (and `test_document_viewer.py` 7/7) in isolation, DB up
- Node byte-identity check: 19/20 non-table samples byte-identical; the one diff is a pathological `|---|`-over-`|---|` sample that the task's literal rule now classifies as a table (new behavior, not a regression)
Deviations: none (header-only tables omit an empty `<tbody>`; placeholder paragraph-wrapping mirrors the existing fence pattern).
Next pending task: `44_markdown_tables/02_mock_table_trigger.md`
@@ -0,0 +1,60 @@
........................................................................ [ 9%]
........................................................................ [ 19%]
........................................................................ [ 29%]
........................................................................ [ 39%]
........................................................................ [ 48%]
........................................................................ [ 58%]
........................................................................ [ 68%]
........................................................................ [ 78%]
........................................................................ [ 87%]
........................................................................ [ 97%]
.................. [100%]
=============================== warnings summary ===============================
.venv/lib/python3.13/site-packages/fastapi/testclient.py:1
/var/home/ducoterra/Projects/Personal/brain_of_reese/.venv/lib/python3.13/site-packages/fastapi/testclient.py:1: StarletteDeprecationWarning: Using `httpx` with `starlette.testclient` is deprecated; install `httpx2` instead.
from starlette.testclient import TestClient as TestClient # noqa
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
================================ tests coverage ================================
_______________ coverage: platform linux, python 3.13.13-final-0 _______________
Name Stmts Miss Cover
--------------------------------------------
app/__init__.py 1 0 100%
app/api/__init__.py 0 0 100%
app/api/auth.py 22 0 100%
app/api/chat.py 122 0 100%
app/api/config.py 7 0 100%
app/api/docs.py 23 0 100%
app/api/git_sources.py 66 0 100%
app/api/health.py 10 0 100%
app/api/steering.py 42 0 100%
app/api/suggestions.py 8 0 100%
app/api/sync.py 81 0 100%
app/config.py 66 0 100%
app/core/__init__.py 0 0 100%
app/core/auth.py 20 0 100%
app/core/caching.py 92 0 100%
app/core/debugging.py 29 2 93%
app/core/logging.py 13 0 100%
app/db.py 21 0 100%
app/main.py 44 0 100%
app/models.py 60 0 100%
app/rag/__init__.py 0 0 100%
app/rag/agent.py 81 0 100%
app/rag/chunker.py 206 4 98%
app/rag/git_sources.py 14 0 100%
app/rag/importer.py 173 3 98%
app/rag/llm.py 186 0 100%
app/rag/overview.py 71 0 100%
app/rag/prompts.py 65 0 100%
app/rag/retriever.py 94 3 97%
app/rag/suggestions.py 27 0 100%
app/rag/summarizer.py 24 0 100%
app/schemas.py 99 0 100%
--------------------------------------------
TOTAL 1767 12 99%
coverage gate: app/ 99% (>90%) OK
All checks passed!
0 errors, 0 warnings, 0 informations
validation OK
@@ -0,0 +1,17 @@
All green. Task 02 complete — report:
**Implemented** (`tests/e2e/mock_llm.py` only):
- `TABLE_TRIGGER = "show me a table"` (case-insensitive-substring convention) + byte-stable `TABLE_ANSWER`: 3-column service table, the `<img onerror>` XSS probe line, and a wide 5-column table
- `compose_answer()` branch placed before `DEFLECT_MODE` (after the prompt-mode markers, before the default tail-echo) — a marker question always gets the table answer regardless of gate
- Module docstring marker list updated with the table row
**Verified**:
- Functional checks: trigger (HIGH) → exact `TABLE_ANSWER`; trigger + `DEFLECT_MODE` → table wins; default / `DEFLECT_MODE` / `SUMMARY_MODE` / `LONG_ANSWER` paths unchanged; no existing E2E question or fixture contains the phrase (repo-wide grep)
- `TABLE_ANSWER` renders through the phase-44 renderer (node): 2 `md-table` tables, `th scope="col"`, escaped XSS line, no raw `|---|` — ready for task 03's E2E assertions
- `uv run pytest --cov=app --cov-report=term-missing` → 738 passed, `app/` TOTAL 99% (>90%, unchanged)
- `uv run ruff check .` → clean; `uv run pyright` → 0 errors
- No mock-level unit test file exists, so no unit-test addition per the task's conditional
**Decisions**: branch ordered after `SUMMARY_MODE`/`KB_OVERVIEW_MODE` so prompt-mode calls can't be shadowed by a document containing the phrase; answer is 78 words, far under `max_tokens` (2048/32k) so `_apply_max_tokens` passes it byte-identical. No commit made — committing belongs to task 03.
**Next pending task**: `.agents/phases/todo/44_markdown_tables/03_tables_e2e_and_commit.md`
@@ -0,0 +1,60 @@
........................................................................ [ 9%]
........................................................................ [ 19%]
........................................................................ [ 29%]
........................................................................ [ 39%]
........................................................................ [ 48%]
........................................................................ [ 58%]
........................................................................ [ 68%]
........................................................................ [ 78%]
........................................................................ [ 87%]
........................................................................ [ 97%]
.................. [100%]
=============================== warnings summary ===============================
.venv/lib/python3.13/site-packages/fastapi/testclient.py:1
/var/home/ducoterra/Projects/Personal/brain_of_reese/.venv/lib/python3.13/site-packages/fastapi/testclient.py:1: StarletteDeprecationWarning: Using `httpx` with `starlette.testclient` is deprecated; install `httpx2` instead.
from starlette.testclient import TestClient as TestClient # noqa
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
================================ tests coverage ================================
_______________ coverage: platform linux, python 3.13.13-final-0 _______________
Name Stmts Miss Cover
--------------------------------------------
app/__init__.py 1 0 100%
app/api/__init__.py 0 0 100%
app/api/auth.py 22 0 100%
app/api/chat.py 122 0 100%
app/api/config.py 7 0 100%
app/api/docs.py 23 0 100%
app/api/git_sources.py 66 0 100%
app/api/health.py 10 0 100%
app/api/steering.py 42 0 100%
app/api/suggestions.py 8 0 100%
app/api/sync.py 81 0 100%
app/config.py 66 0 100%
app/core/__init__.py 0 0 100%
app/core/auth.py 20 0 100%
app/core/caching.py 92 0 100%
app/core/debugging.py 29 2 93%
app/core/logging.py 13 0 100%
app/db.py 21 0 100%
app/main.py 44 0 100%
app/models.py 60 0 100%
app/rag/__init__.py 0 0 100%
app/rag/agent.py 81 0 100%
app/rag/chunker.py 206 4 98%
app/rag/git_sources.py 14 0 100%
app/rag/importer.py 173 3 98%
app/rag/llm.py 186 0 100%
app/rag/overview.py 71 0 100%
app/rag/prompts.py 65 0 100%
app/rag/retriever.py 94 3 97%
app/rag/suggestions.py 27 0 100%
app/rag/summarizer.py 24 0 100%
app/schemas.py 99 0 100%
--------------------------------------------
TOTAL 1767 12 99%
coverage gate: app/ 99% (>90%) OK
All checks passed!
0 errors, 0 warnings, 0 informations
validation OK
@@ -0,0 +1,11 @@
Complete. Final report:
**Phase 44, task 03 — Markdown tables E2E + regressions + commit**
- **Story E2E** `tests/e2e/test_markdown_tables.py` (new, 6 tests): chat table shape (thead/th scope=col, body cells, no `|---|` leak, non-deflected), wide-table wrapper scroll + no page overflow, XSS probe inert (0 `<img>`, no dialog), viewer-modal table from the new `homelab/tables.md` fixture, pipe-heavy fence stays `<pre><code>`, lone `|` stays text — **6/6 green in isolation**
- **Fixture**: `tests/fixtures/docs/homelab/tables.md` (3×3 table + fenced pipe block) → shared fixture set 8→9 docs; updated all count pins across 19 E2E + 5 integration suites
- **Defect fixes found while testing**: ① task-01's `.md-table { width:100% }` collapsed the wide table (never scrolled) — added `min-width: max-content` (+ unit pin); ② pre-existing flake in `test_agent_document_tools` (failed 3/5 on committed baseline — polling expect strides over the ~0.4 s "Calling tool…" window; replaced with the deterministic MutationObserver record) — now 10/10 stable
- **Results**: `uv run pytest --cov=app` → 738 passed, TOTAL 99% (unchanged, >90%); `uv run ruff check . && uv run pyright` clean; regressions in isolation all green (test_chat_rag 3, test_document_viewer 7, test_document_summaries 2, test_smoke 3) + all 31 other E2E suites verified
- **Commit**: `bc70ce3 feat(chat): render markdown tables in answers, viewer, and thinking` (--no-gpg-sign, 30 files)
- **Deviation**: phase dir not moved — harness moves task files on success (per executor rules)
- **Next pending task**: none in `44_markdown_tables` (this was the phase's last task)
@@ -0,0 +1,60 @@
........................................................................ [ 9%]
........................................................................ [ 19%]
........................................................................ [ 29%]
........................................................................ [ 39%]
........................................................................ [ 48%]
........................................................................ [ 58%]
........................................................................ [ 68%]
........................................................................ [ 78%]
........................................................................ [ 87%]
........................................................................ [ 97%]
.................. [100%]
=============================== warnings summary ===============================
.venv/lib/python3.13/site-packages/fastapi/testclient.py:1
/var/home/ducoterra/Projects/Personal/brain_of_reese/.venv/lib/python3.13/site-packages/fastapi/testclient.py:1: StarletteDeprecationWarning: Using `httpx` with `starlette.testclient` is deprecated; install `httpx2` instead.
from starlette.testclient import TestClient as TestClient # noqa
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
================================ tests coverage ================================
_______________ coverage: platform linux, python 3.13.13-final-0 _______________
Name Stmts Miss Cover
--------------------------------------------
app/__init__.py 1 0 100%
app/api/__init__.py 0 0 100%
app/api/auth.py 22 0 100%
app/api/chat.py 122 0 100%
app/api/config.py 7 0 100%
app/api/docs.py 23 0 100%
app/api/git_sources.py 66 0 100%
app/api/health.py 10 0 100%
app/api/steering.py 42 0 100%
app/api/suggestions.py 8 0 100%
app/api/sync.py 81 0 100%
app/config.py 66 0 100%
app/core/__init__.py 0 0 100%
app/core/auth.py 20 0 100%
app/core/caching.py 92 0 100%
app/core/debugging.py 29 2 93%
app/core/logging.py 13 0 100%
app/db.py 21 0 100%
app/main.py 44 0 100%
app/models.py 60 0 100%
app/rag/__init__.py 0 0 100%
app/rag/agent.py 81 0 100%
app/rag/chunker.py 206 4 98%
app/rag/git_sources.py 14 0 100%
app/rag/importer.py 173 3 98%
app/rag/llm.py 186 0 100%
app/rag/overview.py 71 0 100%
app/rag/prompts.py 65 0 100%
app/rag/retriever.py 94 3 97%
app/rag/suggestions.py 27 0 100%
app/rag/summarizer.py 24 0 100%
app/schemas.py 99 0 100%
--------------------------------------------
TOTAL 1767 12 99%
coverage gate: app/ 99% (>90%) OK
All checks passed!
0 errors, 0 warnings, 0 informations
validation OK