Skip to content

dev-docs: introduce application_model.md as entry point, normalize naming, clean work/#134

Merged
cboos merged 5 commits intomainfrom
dev/dev-docs-restructure
May 7, 2026
Merged

dev-docs: introduce application_model.md as entry point, normalize naming, clean work/#134
cboos merged 5 commits intomainfrom
dev/dev-docs-restructure

Conversation

@cboos
Copy link
Copy Markdown
Collaborator

@cboos cboos commented Apr 29, 2026

Summary

Restructures dev-docs/ and work/ so the directories cleanly separate as-built reference (dev-docs/) from plans/TODOs (work/), and introduces a lean entry-point document for dev-docs/.

  • New dev-docs/application_model.md — entry-point doc covering subsystems, data lifecycle, glossary, and inline coverage of subsystems without their own deep-dive (CLI, TUI, cache implementation, migrations, detail-level filter, image export, performance profiling).
  • dev-docs/FOLD_STATE_DIAGRAM.mddev-docs/message-hierarchy.md (drops the SCREAMING_SNAKE; H1 also updated).
  • dev-docs/restoring-archived-sessions.mddocs/restoring-archived-sessions.md (user-facing operations; docs/ is the new home for end-user documentation).
  • dev-docs/rendering-next.mdwork/rendering-next.md (it was always future-work content).
  • work/phase-c-agent-transcripts.md deleted: the work fully landed via Integrate agent transcripts into the DAG (Phase C) #99; the as-built reality is now in agents.md.
  • Inbound references updated in CLAUDE.md, CONTRIBUTING.md, claude_code_log/converter.py (URL points at docs/), and the four dev-docs/*.md files that cross-referenced the moved/renamed pages.
  • Surviving dev-docs all carry a one-line breadcrumb pointing at application_model.md so a reader landing on a deep-dive without context finds the system overview.

Validation

A second commit (027f8c6) folds in three follow-up fixes from a docs-walk-through with a fresh reader — they navigated application_model.mddag.mdmessages.md cleanly to investigate a hypothetical branch-heading rendering bug, but flagged that the label composition surface (_branch_label, _enrich_branch_titles, create_session_preview, simplify_command_tags) wasn't reachable from the docs alone:

  1. New SessionHeaderMessage glossary entry naming the four functions involved.
  2. Cross-reference in dag.md's "Navigation Links" section pointing at the glossary entry — keeps dag.md focused on structure without leaving a silent dead end on labeling.
  3. Cross-cutting-concerns paragraph after the § 1 subsystem table calling out "label and preview composition" as the canonical multi-row concern.

Resulting structure

dev-docs/
├── application_model.md      ← entry point (new)
├── rendering-architecture.md (stays — pipeline deep-dive)
├── dag.md
├── messages.md + messages/
├── agents.md
├── teammates.md
├── message-hierarchy.md      ← renamed from FOLD_STATE_DIAGRAM.md
├── css-classes.md
└── implementing-a-tool-renderer.md

docs/                          ← new directory (user-facing)
└── restoring-archived-sessions.md

work/
├── async-agents.md
├── rendering-next.md         ← moved from dev-docs/
└── session-state-propagation.md

Test plan

  • Doc-only changes; no code or tests affected.
  • Inbound references checked: grep -rIn "FOLD_STATE_DIAGRAM\|phase-c-agent-transcripts" returns nothing outside test fixtures.
  • Breadcrumb links in each surviving dev-docs/*.md resolve (relative paths verified).
  • CLAUDE.md and CONTRIBUTING.md Architecture sections updated to point at application_model.md first.
  • Cold-read navigation walk-through with a fresh reader: entry point worked end-to-end; gaps surfaced by the walk-through are addressed in the follow-up commit.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Documentation
    • Reorganized docs for clearer navigation between user guides, developer reference, and planning content.
    • Added a comprehensive system overview to streamline onboarding and explain subsystems, data lifecycle, and terminology.
    • Expanded and cross-linked guides (DAGs, rendering, message hierarchy, tool-renderer how-to) for better discoverability and consistency.
    • Updated rendering docs to describe JSON export and clarify separation of concerns.
    • Removed an outdated planning document and updated user-facing links.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 29, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 0541c9ef-72ec-46cc-a9fe-2ccff32d433e

📥 Commits

Reviewing files that changed from the base of the PR and between 360e071 and 985938c.

📒 Files selected for processing (1)
  • CLAUDE.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • CLAUDE.md

📝 Walkthrough

Walkthrough

Introduces a central developer entry point dev-docs/application_model.md, updates many dev-docs and repo docs to reference it, adjusts several relative links, deletes an obsolete work doc, and fixes one user-facing archived-sessions URL string. All edits are documentation or string-literal changes; no public API changes.

Changes

Documentation and navigation rework

Layer / File(s) Summary
New entrypoint
dev-docs/application_model.md
Adds a comprehensive application model covering subsystems, data lifecycle, glossary, rendering targets (HTML/Markdown/JSON), caches, migrations, and onboarding guidance.
Core content additions
dev-docs/rendering-architecture.md, dev-docs/dag.md, dev-docs/implementing-a-tool-renderer.md
Expands rendering architecture (adds RenderingContext, JSON output, Separation of Concerns), broadens DAG design and adds a phased implementation plan, and provides a detailed 6-step tool-renderer how-to including JSON notes.
Cross-reference updates
dev-docs/messages.md, dev-docs/css-classes.md, dev-docs/agents.md, dev-docs/teammates.md, dev-docs/message-hierarchy.md
Insert top-of-file pointers to application_model.md and adjust related reference links (e.g., rendering-next path, fold-state → message-hierarchy rename).
Repository navigation docs
CLAUDE.md, CONTRIBUTING.md
Reframe architecture pointer to start at dev-docs/application_model.md, document docs/ (user-facing) and work/ (plans/TODOs), and update File Structure/Architecture references.
User-facing string change
claude_code_log/converter.py
Update archived-sessions note URL from dev-docs/restoring-archived-sessions.md to docs/restoring-archived-sessions.md.
Work docs maintenance
work/phase-c-agent-transcripts.md (deleted), work/rendering-next.md
Remove obsolete Phase C agent transcripts doc; update work/rendering-next.md links to point at ../dev-docs/... targets.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

"I hopped through docs to tidy the trail,
A map of models where questions hail.
One guide to start, links set straight,
Paths now clear — no more debate."

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title clearly and specifically summarizes the main change: restructuring documentation by introducing application_model.md as an entry point, normalizing file naming conventions (e.g., FOLD_STATE_DIAGRAM.md → message-hierarchy.md), and cleaning up the work/ directory.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dev/dev-docs-restructure

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
dev-docs/application_model.md (1)

361-361: Optional: Simplify redundant phrase.

The phrase "in-flight or proposed plan" could be shortened to just "plan" since "in-flight" and "proposed" both already imply it's a plan.

✨ Suggested simplification
-  → [`work/`](../work/) — each `.md` is an in-flight or proposed plan.
+  → [`work/`](../work/) — each `.md` is a plan (in-flight or proposed).

or simply:

-  → [`work/`](../work/) — each `.md` is an in-flight or proposed plan.
+  → [`work/`](../work/) — each `.md` documents planned work.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@dev-docs/application_model.md` at line 361, Replace the redundant phrase in
the documentation entry "→ [`work/`](../work/) — each `.md` is an in-flight or
proposed plan." by changing "in-flight or proposed plan" to simply "plan" so the
line reads "→ [`work/`](../work/) — each `.md` is a plan."; update the
corresponding text in dev-docs/application_model.md where that exact phrase
appears.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@dev-docs/application_model.md`:
- Line 361: Replace the redundant phrase in the documentation entry "→
[`work/`](../work/) — each `.md` is an in-flight or proposed plan." by changing
"in-flight or proposed plan" to simply "plan" so the line reads "→
[`work/`](../work/) — each `.md` is a plan."; update the corresponding text in
dev-docs/application_model.md where that exact phrase appears.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: bb304ab2-92ee-4115-9c32-5cb7c1daf4ae

📥 Commits

Reviewing files that changed from the base of the PR and between 294ed3b and 027f8c6.

📒 Files selected for processing (15)
  • CLAUDE.md
  • CONTRIBUTING.md
  • claude_code_log/converter.py
  • dev-docs/agents.md
  • dev-docs/application_model.md
  • dev-docs/css-classes.md
  • dev-docs/dag.md
  • dev-docs/implementing-a-tool-renderer.md
  • dev-docs/message-hierarchy.md
  • dev-docs/messages.md
  • dev-docs/rendering-architecture.md
  • dev-docs/teammates.md
  • docs/restoring-archived-sessions.md
  • work/phase-c-agent-transcripts.md
  • work/rendering-next.md
💤 Files with no reviewable changes (1)
  • work/phase-c-agent-transcripts.md

cboos and others added 3 commits May 6, 2026 09:59
…lize naming

Split planning content from as-built reference content per the principle
that ``work/`` holds plans/TODOs (authoritative until the code lands)
and ``dev-docs/`` reflects the current code (authoritative once the
code lands).

Three file moves, one rename, one deletion, one new file:

- ``dev-docs/FOLD_STATE_DIAGRAM.md`` → ``dev-docs/message-hierarchy.md``
  (drops the SCREAMING_SNAKE; H1 also updated to "Message Hierarchy
  and Fold State" to match content scope).
- ``dev-docs/restoring-archived-sessions.md`` → ``docs/restoring-archived-sessions.md``
  (user-facing operations content; ``docs/`` is the new home for
  user-facing documentation distinct from contributor docs).
- ``dev-docs/rendering-next.md`` → ``work/rendering-next.md``
  ("Future Work for the rendering system" — explicitly plan content).
- ``work/phase-c-agent-transcripts.md`` deleted: the work fully landed
  via PR #99 (b5aefa0); the as-built reality is now in ``agents.md``.
- ``dev-docs/application_model.md`` (new): entry-point doc.

Inbound references updated in ``CLAUDE.md``, ``CONTRIBUTING.md``,
``claude_code_log/converter.py`` (URL to docs/), and the four dev-docs
that cross-referenced the moved/renamed files.

The new ``application_model.md`` is the entry point: § 1 subsystem
table with pointers to deep-dive docs, § 2 inlined coverage of
subsystems without their own deep-dive (CLI, TUI, cache implementation,
migrations, detail-level filter, image export, performance profiling),
§ 3 data lifecycle ASCII diagram, § 4 cross-cutting glossary
(TranscriptEntry, MessageContent, TemplateMessage, RenderingContext,
session_id and synthetic forms, sidechain, agent_id, fork point,
pair_first/middle/last, detail level, passthrough), § 5 "where to
start reading" by question.

Surviving dev-docs all carry a one-line breadcrumb pointing at
``application_model.md`` so a reader landing on a deep-dive without
context can find the system overview.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…-through

A reviewer reading the new ``application_model.md`` cold landed at
``dag.md`` for branch sessions, but the doc was silent on where the
branch-heading text itself is assembled — they'd have had to grep
``renderer.py`` to find it. Three small fixes close the gap:

1. ``SessionHeaderMessage`` glossary entry in
   ``application_model.md`` § 4: defines the term, distinguishes
   trunk vs branch flavours, names the four functions that compose
   the title (``_branch_label``, ``_enrich_branch_titles``,
   ``create_session_preview``, ``simplify_command_tags``). Lands
   between the ``fork point / branch`` and ``pair_first / middle /
   last`` entries since branch headings are the lookup most likely
   to lead here.

2. Cross-reference in ``dag.md``'s "Navigation Links" section:
   one-line callout that title composition is a renderer concern,
   pointing back at the new glossary entry. Keeps ``dag.md``
   focused on structure (its job) without the reader hitting a
   silent dead end on the labeling question.

3. Cross-cutting-concerns paragraph after the § 1 subsystem table:
   names "label and preview composition" as the canonical example
   of a concern that touches several rows (DAG, renderer, parsing)
   and isn't owned by any single one. Helps the next reader who
   looks for "where do branch labels live?" and finds neither the
   DAG row nor the renderer row obviously authoritative.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…SR1), #133 (factory-layer normalisation seam)

Three PRs landed on main since this branch was created. The dev-docs
deltas they imply:

- **PR #36 (JSON renderer)** —
  - `application_model.md` § 1 subsystem table gains a JSON export
    row; new § 2.5 "JSON export" describes the renderer (mirrors
    HTML/Markdown surface, runs through `generate_template_messages`
    so it inherits all post-factory polishing for free, JSON-specific
    `_json_default` shim for embedded Pydantic models, output naming
    via `variant_suffix`).
  - § 2.1 CLI lists `json` alongside `html`/`md`/`markdown` for
    `--format`.
  - § 3 data lifecycle diagram adds `json/renderer.py` as a third
    fan-out branch alongside HTML/Markdown.
  - § 5 entry-questions gains a "How do I export to JSON?" pointer.
  - `rendering-architecture.md` § 1 / § 4 list JSON; new
    `JsonRenderer` subsection in § 7 describes its serialisation
    approach (single document via `dataclasses.asdict` + shim; only
    reuses `title_content` from the dispatcher).
  - § 10 Separation of Concerns clarifies that **factories/** is the
    normalisation seam — display polish for *all* output formats lives
    there, not in renderers.
  - `implementing-a-tool-renderer.md` Overview + Tests sections note
    that JSON needs no per-tool integration: serialises the typed
    factory output directly.

- **PR #135 (DAG cycle-break + SIGUSR1)** —
  - `dag.md` Phase 2 (Build DAG) gains a mermaid diagram of the
    three-step `build_dag` ordering (orphan promotion → cycle break
    → children build) and explains the ordering rationale (children
    must be built last because cyclic edges in `parent_uuid` would
    propagate into `children_uuids` otherwise, hanging downstream
    walks).
  - Phase 3 documents the `walk_visited` defence-in-depth in
    `_walk_session_with_forks` — backstop for reintroduced cycles
    after build time.
  - Invariant 3 (DAG acyclicity) updated from "no cycles" assertion
    to "actively broken at build time, walker has belt".
  - `application_model.md` new § 2.9 "Diagnosing hangs" describes
    the SIGUSR1 stack-dump handler installed in `cli.py`.

- **PR #133 (system-info-cleanup)** —
  - Already mostly absorbed via the branch-heading navigation gap
    commit; the renormalisation ("if it shows up right in HTML, it
    shows up right in JSON") and the explicit "factory-layer
    normalisation seam" framing in `rendering-architecture.md` § 10
    cite `simplify_command_tags` as the canonical example.

Also drive-by: § 2.6 detail-level table now includes the `high`
level (was missing — `models.DetailLevel.HIGH` predates this branch
but the doc never listed it).

`just ci` clean.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@cboos cboos force-pushed the dev/dev-docs-restructure branch from 027f8c6 to efce0d2 Compare May 6, 2026 08:09
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@dev-docs/application_model.md`:
- Around line 75-76: The doc text misstates the scope of the --page-size flag:
update the sentence that currently reads "`--page-size N` — split per-session
HTML into N-message pages." to clarify that pagination applies to the combined
transcript output (e.g., "split the combined transcript HTML into N-message
pages") so readers understand --page-size affects the merged/combined transcript
output rather than individual session files; keep the flag name `--page-size` in
the updated sentence for clarity.
- Around line 230-237: Update the image export mode names in the documentation
to match the runtime/CLI terminology: replace `inline` with `embedded`,
`dropped` with `placeholder`, and keep `referenced`; also update the default
sentence to state "embedded for Markdown (single self-contained file) and
referenced for HTML (small files, no inline payload bloat)". Verify the
surrounding text that enumerates modes (the list containing
`inline/referenced/dropped`) and any examples or flag references to use
`embedded/referenced/placeholder` so contributors use the correct CLI flag
values.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ea6efe2d-e1f9-415f-96e7-832d2599f68b

📥 Commits

Reviewing files that changed from the base of the PR and between 027f8c6 and efce0d2.

📒 Files selected for processing (15)
  • CLAUDE.md
  • CONTRIBUTING.md
  • claude_code_log/converter.py
  • dev-docs/agents.md
  • dev-docs/application_model.md
  • dev-docs/css-classes.md
  • dev-docs/dag.md
  • dev-docs/implementing-a-tool-renderer.md
  • dev-docs/message-hierarchy.md
  • dev-docs/messages.md
  • dev-docs/rendering-architecture.md
  • dev-docs/teammates.md
  • docs/restoring-archived-sessions.md
  • work/phase-c-agent-transcripts.md
  • work/rendering-next.md
💤 Files with no reviewable changes (1)
  • work/phase-c-agent-transcripts.md
✅ Files skipped from review due to trivial changes (1)
  • work/rendering-next.md

Comment thread dev-docs/application_model.md Outdated
Comment thread dev-docs/application_model.md Outdated
…rt modes)

Two doc claims didn't match the actual code; both verified directly
against `cli.py` / `converter.py` / `image_export.py` rather than the
CR text alone.

- L75-76 page-size scope: clarify pagination targets the
  combined-transcript output (whole-session packing into N-message
  pages, with overflow when a single session exceeds N), not
  per-session HTML files. Verified against `cli.py:547-551` (help
  text says "combined transcript") and `converter.py:1002`
  `_assign_sessions_to_pages` (per-page accumulation at the
  combined-transcript level).

- § 2.7 image-export modes: rewrite to match the actual CLI choices.
  Mode names were wrong (`inline/referenced/dropped` →
  `placeholder/embedded/referenced`); defaults were also swapped
  (now `embedded` for HTML, `referenced` for Markdown). Verified
  against `cli.py:541-544` and `image_export.py:29-45`.

Skipped CR's L361 nit ("each `.md` is an in-flight or proposed plan"
→ "each `.md` is a plan"): the longer phrasing carries information
about work/'s mixed state and isn't redundant.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@daaain
Copy link
Copy Markdown
Owner

daaain commented May 7, 2026

This is great! The only thing I'm wondering is if we should add some strongly worded exhortation in CLAUDE.md for Claude to keep it updated when doing bigger changes?

@cboos
Copy link
Copy Markdown
Collaborator Author

cboos commented May 7, 2026

Some context: at the beginning, Claude Code was eager to throw in lots of .md documents, left and right. You may remember that I committed some by accident at random places in the project ;-)
Later, I was more careful to have him write them only in dev-docs/. But it was still a mix of work-in-progress, ideas, and actual developer documentation. Hence, the present clean-up.

This aligns with my own practice: start with documents in work/ (I even have work/future/, work/archive/, but then I don't have GitHub PRs, so that would be overkill here). Sharing the branch's work/document is still useful, I think, and when the feature is implemented, the material in there can be integrated into dev-docs/, as such, or dispatched to existing docs, and, on this occasion, updated to match what was implemented. The document status evolves, from authoritative spec in work/ for guiding initial development, to WIP scratchpad (the spec evolves as the code adapts to reality), to dev-docs/ where it's no longer a spec but informational (the code is now the authoritative part).

So, yes, there's a need to keep dev-docs/ "in sync" as the code evolves, if we want it to be useful and not misleading. I do that from time to time, and I noticed that Claude Code does it as well, but this could be made more systematic with appropriate instructions in CLAUDE.md.

Per discussion on PR #134: dev-docs/ are useful only if they remain
true to the as-built reality. Articulate the principle (code is
authoritative; doc is wrong if they disagree) and the work/ →
dev-docs/ lifecycle so non-trivial changes prompt a doc update in
the same commit.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@cboos
Copy link
Copy Markdown
Collaborator Author

cboos commented May 7, 2026

(Claude) Good prompt — pushed 985938c adding a short subsection at the end of CLAUDE.md's Architecture block:

Keeping dev-docs/ in sync

dev-docs/ is as-built reference — the code is the authoritative source. When a non-trivial change alters behavior, structure, or invariants documented in a deep-dive, update the relevant page in the same commit (or as a prompt follow-up). If dev-docs/ and the code disagree, the doc is wrong.

Typical lifecycle: a feature begins as a spec in work/, evolves into a WIP scratchpad as the code adapts to reality, then graduates into dev-docs/ (new page or merged into an existing one) once the implementation has stabilized.

The first paragraph is the actionable directive (code is authoritative, fix the doc when they diverge). The second paragraph captures the work/dev-docs/ lifecycle from your reply so a future Claude session lands on the right home for whatever it's writing.

Kept it terse per the project's CLAUDE.md style guide; left CONTRIBUTING.md untouched to avoid duplication. Open to wording tweaks if you want more or less force.

@cboos cboos merged commit d784e7e into main May 7, 2026
11 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