Skip to content

docs: add comprehensive subdirectory CLAUDE.md files and update root - #589

Merged
ilblackdragon merged 2 commits into
mainfrom
docs/claude-md-improvements
Mar 7, 2026
Merged

ilblackdragon merged 2 commits into
mainfrom
docs/claude-md-improvements

Conversation

@henrypark133

Copy link
Copy Markdown
Collaborator

Summary

The IronClaw repo has grown significantly — many modules existed in code with no documentation. This PR adds module-level CLAUDE.md files for the five most complex subsystems and brings the root CLAUDE.md up to date.

Process: Initial docs were written by reading the existing CLAUDE.md and key source files. Then 6 parallel sub-agents each read all source files in their assigned directory to verify and correct the docs. A final review pass caught cross-file consistency issues (misattributed features, incomplete listings, stale method counts).

New files

File What it covers
src/agent/CLAUDE.md 19-file module map, session/thread/turn model, agentic loop flow, 3 compaction strategies with correct thresholds, scheduler TOCTOU invariants, complete submission command reference
src/channels/web/CLAUDE.md 50+ API routes, SSE event types, auth gotchas (query-string token allowlist), connection limits (100 max, 256-event buffer), CORS headers, step-by-step endpoint guide
src/db/CLAUDE.md 7 sub-traits (~67 methods), SQL dialect differences table (bool/timestamp/vector/JSON gotchas), full schema table, LibSqlBackend::new_memory() test helper
src/llm/CLAUDE.md Corrected LlmProvider trait (was entirely wrong), provider chain decorator order, NEAR AI session renewal mechanics, circuit breaker thresholds, previously undocumented smart_routing.rs and recording.rs
tests/e2e/CLAUDE.md conftest fixture scoping, env injected into binary, SIGINT teardown for coverage, mock_llm canned responses, @pytest.mark.asyncio warning

Root CLAUDE.md changes

  • Added E2E test setup commands and integration test commands
  • Documented ~15 modules that existed in code but were absent from the structure: cli/, registry/, hooks/, tunnel/, observability/, cost_guard.rs, job_monitor.rs, webhook_server.rs, new tool builtins, etc.
  • Corrected libSQL backend path: libsql_backend.rs → libsql/ directory with all 8 sub-modules
  • Updated Database trait method count: ~60 → ~67 (split across 7 sub-traits)
  • Fixed stale references: config.rs → config/channels.rs, main.rs → app.rs
  • Added Hook, Observer, Tunnel traits to the extensibility section
  • Added tunnel and observability env vars to the Configuration section
  • Removed resolved TODO (webhook trigger shipped in a previous PR)

🤖 Generated with Claude Code

The repo has grown significantly. This adds module-level CLAUDE.md files
for the five most complex subsystems, and updates the root CLAUDE.md to
reflect the actual current state of the codebase.

New files:
- src/agent/CLAUDE.md — full module map (19 files), session/thread/turn
  model, agentic loop flow, compaction strategies with correct thresholds,
  scheduler invariants, self-repair details, complete submission command
  reference table
- src/channels/web/CLAUDE.md — complete API route table (50+ endpoints),
  SSE event type reference, auth/rate limiting gotchas, connection limits,
  CORS headers, step-by-step endpoint addition guide
- src/db/CLAUDE.md — dual-backend build commands, sub-trait structure
  (7 sub-traits, ~67 methods), SQL dialect differences, boolean/timestamp
  gotchas, complete schema table, in-memory test helper, shared handle pattern
- src/llm/CLAUDE.md — corrected LlmProvider trait signatures, provider
  chain decorator order, NEAR AI dual-auth and session renewal details,
  circuit breaker thresholds, previously undocumented smart_routing.rs
  and recording.rs
- tests/e2e/CLAUDE.md — conftest fixtures and async scoping, environment
  injected into the binary, mock_llm canned responses, writing guide with
  correct asyncio usage, gotchas section

Root CLAUDE.md updates:
- Added E2E test setup and integration test commands
- Documented ~15 undocumented modules: cli/, registry/, hooks/, tunnel/,
  observability/, webhook_server.rs, cost_guard.rs, job_monitor.rs, etc.
- Corrected libSQL backend path (libsql/ directory, 8 sub-modules)
- Updated Database trait method count (~67, split across 7 sub-traits)
- Fixed stale references: config.rs → config/channels.rs, main.rs → app.rs
- Added Hook, Observer, Tunnel traits to extensibility section
- Added tunnel and observability env vars to Configuration section
- Removed resolved TODO (webhook trigger is now shipped)
- Added Module Specifications entries for all 5 new CLAUDE.md files

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings March 6, 2026 03:07
@github-actions github-actions Bot added scope: agent Agent core (agent loop, router, scheduler) scope: channel/web Web gateway channel scope: llm LLM integration scope: docs Documentation size: XS < 10 changed lines (excluding docs) risk: medium Business logic, config, or moderate-risk modules contributor: core 20+ merged PRs labels Mar 6, 2026
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the project's documentation by adding detailed, module-level CLAUDE.md files for core subsystems and updating the root documentation to reflect the current architecture and operational procedures. The changes aim to improve onboarding for new contributors and provide a clearer understanding of complex components, ensuring that the documentation accurately mirrors the codebase's evolution.

Highlights

  • New Module-Level Documentation: Introduced five new comprehensive CLAUDE.md files for the most complex subsystems: src/agent/, src/channels/web/, src/db/, src/llm/, and tests/e2e/. These files provide detailed module maps, architectural overviews, API references, and operational guidelines.
  • Root Documentation Updates: The root CLAUDE.md file has been significantly updated to include setup instructions for integration and E2E tests, document approximately 15 previously undocumented modules (e.g., cli/, registry/, hooks/, tunnel/, observability/), correct stale references, and expand the extensibility section with new traits like Hook, Observer, and Tunnel.
  • Enhanced Project Structure Clarity: The project structure section in the root CLAUDE.md was thoroughly revised to reflect current file organization, including the new config/ subdirectory for subsystem-specific configurations and the libsql/ directory for the libSQL backend implementation.
  • Database Module Refinement: The database documentation now clarifies the dual-backend persistence layer, detailing the Database supertrait and its six sub-traits, SQL dialect differences between PostgreSQL and libSQL, key tables, and current limitations of the libSQL implementation.
  • LLM Integration Details: The LLM module documentation provides in-depth information on multi-provider integration, including NEAR AI specifics, circuit breaker patterns, failover chains, retry mechanisms, response caching, and the construction of the LLM provider chain.
Changelog
  • CLAUDE.md
    • Added instructions for running integration and E2E tests.
    • Updated project structure documentation to reflect new modules and reorganized configuration.
    • Expanded agent module documentation with new components like cost_guard.rs and job_monitor.rs.
    • Updated project structure documentation to include new CLI, registry, hooks, tunnel, and observability modules, and detailed web channel handlers.
    • Added credential_detect.rs to the safety layer documentation.
    • Expanded built-in tools documentation with new tools like web_fetch.rs, message.rs, secrets_tools.rs, html_converter.rs, and path_utils.rs.
    • Added session.rs to the MCP module documentation.
    • Updated database module documentation to reflect the new libsql/ directory structure and increased method count.
    • Updated secrets management module documentation to include keychain.rs and reorganize store.rs.
    • Added tests/ directory structure documentation.
    • Expanded extensibility section with Hook, Observer, and Tunnel traits.
    • Added environment variables for tunnel and observability configuration.
    • Corrected the path for libSQL backend documentation.
    • Updated the list of future work/TODOs, removing the webhook trigger and adding observability backends.
    • Updated instructions for adding new channels, referencing src/config/channels.rs and src/app.rs.
    • Added new CLAUDE.md files to the module spec table.
  • src/agent/CLAUDE.md
    • Added comprehensive documentation for the agent module, including its module map, session/thread/turn model, agentic loop flow, command routing, compaction strategies, scheduler, self-repair, key invariants, and submission command reference.
  • src/channels/web/CLAUDE.md
    • Added comprehensive documentation for the web gateway module, detailing its file map, API routes, SSE event types, authentication mechanisms, connection limits, CORS headers, and guidelines for adding new endpoints.
  • src/db/CLAUDE.md
    • Added comprehensive documentation for the database module, covering its dual-backend persistence layer, file map, trait structure, guidelines for adding new operations, SQL dialect differences, key tables, libSQL limitations, and local running/testing instructions.
  • src/llm/CLAUDE.md
    • Added comprehensive documentation for the LLM module, detailing its multi-provider integration, file map, provider selection, NEAR AI specifics, circuit breaker, failover chain, retry mechanisms, LlmProvider trait, response cache, custom headers, provider chain construction, reasoning.rs contents, costs.rs details, rig_adapter.rs details, streaming support, and trace recording.
  • tests/e2e/CLAUDE.md
    • Added comprehensive documentation for the E2E test suite, including setup instructions, running tests, test scenarios, helpers.py utilities, conftest.py fixtures, environment variables, mock LLM usage, configuration, guidelines for writing new scenarios, and CI integration.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a significant and much-needed documentation update, adding comprehensive CLAUDE.md files for several complex subsystems and bringing the root documentation up to date. The new documents are thorough and will be a great resource for developers. My review focuses on a few minor inconsistencies in the new documentation to ensure its accuracy.

Note: Security Review has been skipped due to the limited scope of the PR.

Comment thread CLAUDE.md Outdated
# Run E2E tests (Python/Playwright — requires a running ironclaw instance)
# See tests/e2e/CLAUDE.md for full setup instructions
cd tests/e2e
python -m venv .venv && source .venv/bin/activate

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The source .venv/bin/activate command is specific to Unix-like shells. For completeness, it would be helpful to add a note for Windows users, similar to the one in tests/e2e/CLAUDE.md.

Suggested change
python -m venv .venv && source .venv/bin/activate
python -m venv .venv && source .venv/bin/activate # On Windows, use .venv\Scripts\activate

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in b340a6a.

Comment thread CLAUDE.md Outdated
│
├── db/ # Database abstraction layer
│ ├── mod.rs # Database trait (~60 async methods)
│ ├── mod.rs # Database supertrait + 6 sub-traits (~67 async methods)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The Database supertrait is composed of 7 sub-traits, but this line says 6. The sub-traits are ConversationStore, JobStore, SandboxStore, RoutineStore, ToolFailureStore, SettingsStore, and WorkspaceStore.

Suggested change
│ ├── mod.rs # Database supertrait + 6 sub-traits (~67 async methods)
│ ├── mod.rs # Database supertrait + 7 sub-traits (~67 async methods)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in b340a6a.

Comment thread src/db/CLAUDE.md Outdated

| File | Role |
|------|------|
| `mod.rs` | `Database` supertrait + 6 sub-traits (~67 async methods total) — add new ops here first |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The Database supertrait is composed of 7 sub-traits, but this line says 6. The table of sub-traits below correctly lists 7.

Suggested change
| `mod.rs` | `Database` supertrait + 6 sub-traits (~67 async methods total) — add new ops here first |
| `mod.rs` | `Database` supertrait + 7 sub-traits (~67 async methods total) — add new ops here first |

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in b340a6a.

Comment thread src/db/CLAUDE.md Outdated

## Trait Structure

The `Database` supertrait is composed of six sub-traits. Leaf consumers can depend on the narrowest sub-trait they need rather than the full `Database`:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The Database supertrait is composed of seven sub-traits, not six.

Suggested change
The `Database` supertrait is composed of six sub-traits. Leaf consumers can depend on the narrowest sub-trait they need rather than the full `Database`:
The `Database` supertrait is composed of seven sub-traits. Leaf consumers can depend on the narrowest sub-trait they need rather than the full `Database`:

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in b340a6a.

Comment thread src/db/CLAUDE.md
Comment on lines +45 to +53
| Sub-trait | Methods | Covers |
|-----------|---------|--------|
| `ConversationStore` | 11 | Conversations, messages |
| `JobStore` | 14 | Agent jobs, actions, LLM calls, estimation |
| `SandboxStore` | 13 | Sandbox jobs, job events |
| `RoutineStore` | 14 | Routines, routine runs |
| `ToolFailureStore` | 4 | Self-repair tracking |
| `SettingsStore` | 8 | Per-user key-value settings |
| `WorkspaceStore` | 13 | Memory documents, chunks, hybrid search |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The method counts for some of the sub-traits in this table appear to be out of date. Based on src/db/mod.rs, the counts are:

  • ConversationStore: 12 (not 11)
  • JobStore: 13 (not 14)
  • RoutineStore: 15 (not 14)

The total method count is closer to 78, not ~67. Updating these numbers would improve the accuracy of this excellent documentation.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in b340a6a.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR adds comprehensive module-level CLAUDE.md documentation files for five complex subsystems (src/agent/, src/channels/web/, src/db/, src/llm/, tests/e2e/) and updates the root CLAUDE.md to reflect the current state of the codebase — adding previously undocumented modules, correcting stale file paths, and updating structural descriptions.

Changes:

  • Added 5 new CLAUDE.md files covering module maps, key patterns, configuration, gotchas, and how-to guides for the agent, web gateway, database, LLM, and E2E test subsystems
  • Updated root CLAUDE.md with ~15 previously undocumented modules (cli/, registry/, hooks/, tunnel/, observability/, etc.), corrected stale paths (config.rs → config/, libsql_backend.rs → libsql/), and added E2E/integration test commands
  • Removed a resolved TODO (webhook trigger) and added new extensibility traits (Hook, Observer, Tunnel) and environment variables to the configuration section

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/agent/CLAUDE.md New: 20-file module map, session/thread/turn model, agentic loop flow, compaction strategies, scheduler invariants, submission command reference
src/channels/web/CLAUDE.md New: Complete API route listing (~59 routes), SSE event types, auth details, connection limits, CORS, step-by-step guides
src/db/CLAUDE.md New: Backend file map, trait structure, SQL dialect differences, schema tables, libSQL limitations, testing helpers
src/llm/CLAUDE.md New: Provider selection, NEAR AI gotchas, circuit breaker/retry/failover details, provider chain construction, trait definition
tests/e2e/CLAUDE.md New: Setup instructions, fixture documentation, mock LLM usage, scenario table, gotchas
CLAUDE.md Updated: Added undocumented modules, corrected file paths, added test commands, updated trait/method counts, added extensibility traits and env vars

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread CLAUDE.md
│ └── allowlist.rs # DomainAllowlist validation
│
├── secrets/ # Secrets management
│ ├── mod.rs # SecretsStore trait, public API

Copilot AI Mar 6, 2026

Copy link

Choose a reason for hiding this comment

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

The secrets/ file tree listing is missing types.rs (which exists at src/secrets/types.rs and contains core types like Secret, SecretRef, SecretMetadata, etc.). The old CLAUDE.md listed it but this update drops it while adding mod.rs and keychain.rs.

Suggested change
│ ├── mod.rs # SecretsStore trait, public API
│ ├── mod.rs # SecretsStore trait, public API
│ ├── types.rs # Core types (Secret, SecretRef, SecretMetadata, etc.)

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in b340a6a.

Comment thread src/db/CLAUDE.md
Comment on lines +25 to +37
| File | Role |
|------|------|
| `mod.rs` | `Database` supertrait + 6 sub-traits (~67 async methods total) — add new ops here first |
| `postgres.rs` | PostgreSQL backend — delegates to `Store` + `Repository` in `history/` |
| `libsql/mod.rs` | libSQL/Turso backend struct, connection helpers, row parsing utilities |
| `libsql/conversations.rs` | `ConversationStore` impl |
| `libsql/jobs.rs` | `JobStore` impl |
| `libsql/sandbox.rs` | `SandboxStore` impl |
| `libsql/routines.rs` | `RoutineStore` impl |
| `libsql/settings.rs` | `SettingsStore` impl |
| `libsql/tool_failures.rs` | `ToolFailureStore` impl |
| `libsql/workspace.rs` | `WorkspaceStore` impl (FTS5 + vector search) |
| `libsql_migrations.rs` | Consolidated libSQL schema (CREATE IF NOT EXISTS, no ALTER TABLE) |

Copilot AI Mar 6, 2026

Copy link

Choose a reason for hiding this comment

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

The file map is missing tls.rs — src/db/tls.rs exists (87 lines) and contains the TLS connector factory for PostgreSQL (create_pool() with rustls + system root certificates). It should be listed alongside the other files in this table.

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in b340a6a.

Comment thread src/db/CLAUDE.md Outdated

| File | Role |
|------|------|
| `mod.rs` | `Database` supertrait + 6 sub-traits (~67 async methods total) — add new ops here first |

Copilot AI Mar 6, 2026

Copy link

Choose a reason for hiding this comment

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

The file map says "6 sub-traits (~67 async methods total)" but the actual src/db/mod.rs defines 7 sub-traits (ConversationStore, JobStore, SandboxStore, RoutineStore, ToolFailureStore, SettingsStore, WorkspaceStore). The total method count is also off — a precise count yields approximately 78 async methods (including run_migrations), not ~67. The "7 sub-traits" number is correctly stated in the trait structure table on line 43 of this same file, so this is an internal inconsistency within the document.

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in b340a6a.

Comment thread src/db/CLAUDE.md Outdated
Comment on lines +48 to +50
| `JobStore` | 14 | Agent jobs, actions, LLM calls, estimation |
| `SandboxStore` | 13 | Sandbox jobs, job events |
| `RoutineStore` | 14 | Routines, routine runs |

Copilot AI Mar 6, 2026

Copy link

Choose a reason for hiding this comment

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

Two method counts in this table are incorrect:

  • JobStore: documented as 14 methods, but src/db/mod.rs defines 13 methods (save_job, get_job, update_job_status, mark_job_stuck, get_stuck_jobs, list_agent_jobs, agent_job_summary, get_agent_job_failure_reason, save_action, get_job_actions, record_llm_call, save_estimation_snapshot, update_estimation_actuals).
  • RoutineStore: documented as 14 methods, but src/db/mod.rs defines 15 methods (create_routine, get_routine, get_routine_by_name, list_routines, list_all_routines, list_event_routines, list_due_cron_routines, update_routine, update_routine_runtime, delete_routine, create_routine_run, complete_routine_run, list_routine_runs, count_running_routine_runs, link_routine_run_to_job).
Suggested change
| `JobStore` | 14 | Agent jobs, actions, LLM calls, estimation |
| `SandboxStore` | 13 | Sandbox jobs, job events |
| `RoutineStore` | 14 | Routines, routine runs |
| `JobStore` | 13 | Agent jobs, actions, LLM calls, estimation |
| `SandboxStore` | 13 | Sandbox jobs, job events |
| `RoutineStore` | 15 | Routines, routine runs |

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in b340a6a.

Comment thread CLAUDE.md Outdated
│
├── db/ # Database abstraction layer
│ ├── mod.rs # Database trait (~60 async methods)
│ ├── mod.rs # Database supertrait + 6 sub-traits (~67 async methods)

Copilot AI Mar 6, 2026

Copy link

Choose a reason for hiding this comment

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

Same inconsistency as in src/db/CLAUDE.md: the actual source (src/db/mod.rs) defines 7 sub-traits (not 6), and the total method count is approximately 78 (not ~67).

Suggested change
│ ├── mod.rs # Database supertrait + 6 sub-traits (~67 async methods)
│ ├── mod.rs # Database supertrait + 7 sub-traits (~78 async methods)

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in b340a6a.

- Fix 7-sub-trait count (was 6) and ~78 async methods (was ~60/~67) in
  both CLAUDE.md and src/db/CLAUDE.md
- Add missing types.rs to secrets/ file tree (CLAUDE.md)
- Add missing tls.rs to src/db/CLAUDE.md Files table
- Fix method counts: ConversationStore 12, JobStore 13, RoutineStore 15
- Add Windows venv activation note to E2E setup commands
- Collapse agent/, web/, llm/, db/ file trees to one-liners (detail
  lives in their respective CLAUDE.md files)
- Replace verbose Database and LLM Providers sections with summaries
  linking to src/db/CLAUDE.md and src/llm/CLAUDE.md
- Root CLAUDE.md: 43,868 → 35,270 chars (fixes >40k perf warning)

[skip-regression-check]

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@ilblackdragon
ilblackdragon merged commit 633b234 into main Mar 7, 2026
17 checks passed
@ilblackdragon
ilblackdragon deleted the docs/claude-md-improvements branch March 7, 2026 08:33
This was referenced Mar 7, 2026
bkutasi pushed a commit to bkutasi/ironclaw that referenced this pull request Mar 28, 2026
…earai#589)

* docs: add comprehensive subdirectory CLAUDE.md files and update root

The repo has grown significantly. This adds module-level CLAUDE.md files
for the five most complex subsystems, and updates the root CLAUDE.md to
reflect the actual current state of the codebase.

New files:
- src/agent/CLAUDE.md — full module map (19 files), session/thread/turn
  model, agentic loop flow, compaction strategies with correct thresholds,
  scheduler invariants, self-repair details, complete submission command
  reference table
- src/channels/web/CLAUDE.md — complete API route table (50+ endpoints),
  SSE event type reference, auth/rate limiting gotchas, connection limits,
  CORS headers, step-by-step endpoint addition guide
- src/db/CLAUDE.md — dual-backend build commands, sub-trait structure
  (7 sub-traits, ~67 methods), SQL dialect differences, boolean/timestamp
  gotchas, complete schema table, in-memory test helper, shared handle pattern
- src/llm/CLAUDE.md — corrected LlmProvider trait signatures, provider
  chain decorator order, NEAR AI dual-auth and session renewal details,
  circuit breaker thresholds, previously undocumented smart_routing.rs
  and recording.rs
- tests/e2e/CLAUDE.md — conftest fixtures and async scoping, environment
  injected into the binary, mock_llm canned responses, writing guide with
  correct asyncio usage, gotchas section

Root CLAUDE.md updates:
- Added E2E test setup and integration test commands
- Documented ~15 undocumented modules: cli/, registry/, hooks/, tunnel/,
  observability/, webhook_server.rs, cost_guard.rs, job_monitor.rs, etc.
- Corrected libSQL backend path (libsql/ directory, 8 sub-modules)
- Updated Database trait method count (~67, split across 7 sub-traits)
- Fixed stale references: config.rs → config/channels.rs, main.rs → app.rs
- Added Hook, Observer, Tunnel traits to extensibility section
- Added tunnel and observability env vars to Configuration section
- Removed resolved TODO (webhook trigger is now shipped)
- Added Module Specifications entries for all 5 new CLAUDE.md files

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* docs: address PR review comments and reduce CLAUDE.md size

- Fix 7-sub-trait count (was 6) and ~78 async methods (was ~60/~67) in
  both CLAUDE.md and src/db/CLAUDE.md
- Add missing types.rs to secrets/ file tree (CLAUDE.md)
- Add missing tls.rs to src/db/CLAUDE.md Files table
- Fix method counts: ConversationStore 12, JobStore 13, RoutineStore 15
- Add Windows venv activation note to E2E setup commands
- Collapse agent/, web/, llm/, db/ file trees to one-liners (detail
  lives in their respective CLAUDE.md files)
- Replace verbose Database and LLM Providers sections with summaries
  linking to src/db/CLAUDE.md and src/llm/CLAUDE.md
- Root CLAUDE.md: 43,868 → 35,270 chars (fixes >40k perf warning)

[skip-regression-check]

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
drchirag1991 pushed a commit to drchirag1991/ironclaw that referenced this pull request Apr 8, 2026
…earai#589)

* docs: add comprehensive subdirectory CLAUDE.md files and update root

The repo has grown significantly. This adds module-level CLAUDE.md files
for the five most complex subsystems, and updates the root CLAUDE.md to
reflect the actual current state of the codebase.

New files:
- src/agent/CLAUDE.md — full module map (19 files), session/thread/turn
  model, agentic loop flow, compaction strategies with correct thresholds,
  scheduler invariants, self-repair details, complete submission command
  reference table
- src/channels/web/CLAUDE.md — complete API route table (50+ endpoints),
  SSE event type reference, auth/rate limiting gotchas, connection limits,
  CORS headers, step-by-step endpoint addition guide
- src/db/CLAUDE.md — dual-backend build commands, sub-trait structure
  (7 sub-traits, ~67 methods), SQL dialect differences, boolean/timestamp
  gotchas, complete schema table, in-memory test helper, shared handle pattern
- src/llm/CLAUDE.md — corrected LlmProvider trait signatures, provider
  chain decorator order, NEAR AI dual-auth and session renewal details,
  circuit breaker thresholds, previously undocumented smart_routing.rs
  and recording.rs
- tests/e2e/CLAUDE.md — conftest fixtures and async scoping, environment
  injected into the binary, mock_llm canned responses, writing guide with
  correct asyncio usage, gotchas section

Root CLAUDE.md updates:
- Added E2E test setup and integration test commands
- Documented ~15 undocumented modules: cli/, registry/, hooks/, tunnel/,
  observability/, webhook_server.rs, cost_guard.rs, job_monitor.rs, etc.
- Corrected libSQL backend path (libsql/ directory, 8 sub-modules)
- Updated Database trait method count (~67, split across 7 sub-traits)
- Fixed stale references: config.rs → config/channels.rs, main.rs → app.rs
- Added Hook, Observer, Tunnel traits to extensibility section
- Added tunnel and observability env vars to Configuration section
- Removed resolved TODO (webhook trigger is now shipped)
- Added Module Specifications entries for all 5 new CLAUDE.md files

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* docs: address PR review comments and reduce CLAUDE.md size

- Fix 7-sub-trait count (was 6) and ~78 async methods (was ~60/~67) in
  both CLAUDE.md and src/db/CLAUDE.md
- Add missing types.rs to secrets/ file tree (CLAUDE.md)
- Add missing tls.rs to src/db/CLAUDE.md Files table
- Fix method counts: ConversationStore 12, JobStore 13, RoutineStore 15
- Add Windows venv activation note to E2E setup commands
- Collapse agent/, web/, llm/, db/ file trees to one-liners (detail
  lives in their respective CLAUDE.md files)
- Replace verbose Database and LLM Providers sections with summaries
  linking to src/db/CLAUDE.md and src/llm/CLAUDE.md
- Root CLAUDE.md: 43,868 → 35,270 chars (fixes >40k perf warning)

[skip-regression-check]

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contributor: core 20+ merged PRs risk: medium Business logic, config, or moderate-risk modules scope: agent Agent core (agent loop, router, scheduler) scope: channel/web Web gateway channel scope: docs Documentation scope: llm LLM integration size: XS < 10 changed lines (excluding docs)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants