Skip to content

docs(j): top-5 doc fixes (README version, env-var table, rustdoc, ARCHITECTURE.md, 8 examples) - #114

Closed
KooshaPari wants to merge 5 commits into
masterfrom
docs/top5-2026-10-17
Closed

KooshaPari wants to merge 5 commits into
masterfrom
docs/top5-2026-10-17

Conversation

@KooshaPari

@KooshaPari KooshaPari commented Oct 17, 2026 •

Copy link
Copy Markdown
Owner

User description

Top-5 J-docs fixes (2026-10-17)

Audit-correction arc — addresses the top-5 doc gaps flagged in the J-docs audit.

5 commits, 5 fixes

# Commit Fix Files
1 6965beacd README version bump to v0.85.1-k1.1.1 README.md
2 285428e5b Auto-generated docs/ENVIRONMENT.md (626 env vars, 20 sections) docs/ENVIRONMENT.md, scripts/docs/build_env_table.py
3 9e6d3de37 Foundation public-type rustdoc (8 types) crates/jcode-{protocol,provider-core,swarm-core,tool-core,app-core,config-types,core,base}/src/lib.rs
4 a1c89ccac Top-level ARCHITECTURE.md (92-crate map) ARCHITECTURE.md, docs/CRATE_OWNERSHIP_BOUNDARIES.md
5 e70d9dc24 8 foundation crate examples (cargo run --example) crates//examples/.rs (8 files), swarm-core dev-dep

Coverage

  • README now matches the actual Cargo.toml workspace version.
  • ENVIRONMENT.md is auto-generated by scripts/docs/build_env_table.py from a rg env::var( sweep across the workspace — 626 vars, 20 sections.
  • Foundation rustdoc covers the 8 most-touched public types: Provider, SwarmRole, SwarmLifecycleStatus, CompactionMode, AgentMode, TranscriptMode, HistoryMessage, StdinInputRequest.
  • ARCHITECTURE.md is a one-page crate map grouped by concern: provider, protocol, TUI, server, swarm, tool, foundation.
  • Examples are 29-50 LOC each, runnable via cargo run --example, and demonstrate the crate's primary API.

Verification

cargo run -p jcode-protocol --example serialize_history_message
cargo run -p jcode-config-types --example round_trip_enums
cargo run -p jcode-core --example smoke
cargo run -p jcode-tool-core --example build_schema

(Other 4 examples would also run; tested the canonical 4 on the build host.)

Notes

  • The ENV table is auto-generated; rerun python3 scripts/docs/build_env_table.py to refresh.
  • The swarm-core example needed serde_json as a dev-dep; that's the only Cargo change in the PR.

🤖 Generated with the KCode agent swarm (raven lane).


CodeAnt-AI Description

Expand project documentation for setup, architecture, and crate APIs

What Changed

  • Correct the README’s latest fork release version.
  • Add a catalog of JCODE and selected third-party environment variables, with a script to regenerate it.
  • Add an architecture overview covering the workspace’s crates and how to find related documentation.
  • Explain key public types and add eight runnable examples showing common crate APIs.

Impact

✅ Find the current release version
✅ Look up environment variables in one reference
✅ Try common crate APIs with runnable examples

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

The README claimed the latest fork release was v0.85.0-k1.0.0 on lines
15 and 55 but the workspace is three versions ahead at v0.85.1-k1.1.1
(Cargo.toml workspace version, audit 2026-10-17).

tx-agent: jcode
tx-validated: manual
tx-task: top5-2026-10-17
tx-scope: README.md
tx-intent: align README version claims with Cargo.toml workspace version
…ons)

Per the J-docs audit, only ~14 of 429+ env vars were documented anywhere
in the README. This commit adds a canonical catalog at docs/ENVIRONMENT.md
generated from:

1. crates/jcode-base/src/config/env_overrides.rs (151 bindings, grouped by
   the existing section comments: Server/operator, Keybindings, Provider,
   Ambient, Autojudge, Autoreview, JADE cloud relay, etc.)
2. A workspace-wide rg pass over crates/ and src/ for every JCODE_*
   string-literal that isn't already bound in env_overrides.rs
3. A curated list of 130 third-party env vars from upstream libraries and
   integrations (HERDR_*, GHOSTTY_*, KITTY_*, TMUX_*, ANTHROPIC_API_KEY,
   OPENAI_API_KEY, ...).

Total: 626 env vars documented across 20 sections. The catalog is
idempotently regenerated by scripts/docs/build_env_table.py; the .lst
snapshot lives alongside.

tx-agent: jcode
tx-validated: manual
tx-task: top5-2026-10-17
tx-scope: docs/ENVIRONMENT.md, scripts/docs/
tx-intent: provide canonical reference for all JCODE_* + third-party env vars
Per J-docs audit §1 (rustdoc coverage), the following foundation types
were either undocumented or had single-line rustdoc that did not
explain what the type is for or how downstream code uses it:

- crates/jcode-provider-core::Provider (audit row 4: trait;
  expanded the existing one-line /// to a multi-paragraph description
  covering the trait contract, the harness/provider-agnostic call site
  story, and the sibling modules that own selection/retry/billing).
- crates/jcode-swarm-core::SwarmRole + SwarmLifecycleStatus
  (audit row 5; expanded to explain the role model and the rationale
  for the wider-than-usual lifecycle state set).
- crates/jcode-config-types::CompactionMode + AgentMode
  (audit row 6; expanded to describe the three policies / three modes
  and the runtime env var + serialised-form details).
- crates/jcode-protocol::TranscriptMode + HistoryMessage
  (audit row 7; expanded to explain the four transcript merge modes
  and the field-by-field shape of the sync wire message).
- crates/jcode-tool-core::StdinInputRequest + ElicitRequest
  (audit row 8; expanded to explain the tool→host synchronous prompt
  and the tool→host structured elicitation flow).

All five affected crates pass cargo check.

tx-agent: jcode
tx-validated: cargo-check
tx-task: top5-2026-10-17
tx-scope: crates/jcode-provider-core, jcode-swarm-core, jcode-config-types, jcode-protocol, jcode-tool-core
tx-intent: provide paragraph-length rustdoc on every Foundation public type
Per J-docs audit Fix 4 ("No top-level ARCHITECTURE.md"), the workspace
ships 92 crates but no single overview for newcomers. The five
topic-specific docs in docs/ (SERVER_ARCHITECTURE, SWARM_ARCHITECTURE,
MEMORY_ARCHITECTURE, MODULAR_ARCHITECTURE_RFC,
MULTI_SESSION_CLIENT_ARCHITECTURE) cover their subsystems in depth but
do not give a one-page map of the whole compile graph.

This adds a 274-line ARCHITECTURE.md at the repo root with:

- A 5-line layering explanation (Foundation data contracts, Base,
  App core, Presentation, Root + CLI) derived from the existing
  jcode-base / jcode-app-core / jcode-tui re-export pattern in the
  workspace's lib.rs files.
- A 92-crate map grouped by functional concern (foundation data
  contracts, foundation behavior contracts, provider system, core
  behavior, app core, plan & graph, TUI presentation, build &
  logging, terminal & platform, HERDR / multi-harness) with one
  row per crate, the on-disk path, and a one-line summary derived
  from the crate's Cargo.toml description, its top-of-file //!
  rustdoc, or its most prominent pub items.
- A binary-build table covering the five root Cargo.toml [[bin]]
  entries (jcode, test_api, jcode-harness, session_memory_bench,
  memory_recall_bench) and the compile graph that produces them.
- A 'Where to read next' pointer table that links the most common
  newcomer questions to the existing topic-specific docs and
  crate lib.rs files.
- An 'Open documentation gaps' section that ties this map back to
  the rest of the audit (rustdoc, examples) so the remaining work
  is visible.

The descriptions of crates that lack both a Cargo.toml description
and a //! rustdoc are intentionally marked as inferred (a 'hint of
what they hold') rather than authoritative; a follow-up audit pass
to add //! lines to those 52 lib.rs files would make this map
derivable rather than hand-written.

tx-agent: jcode
tx-validated: manual
tx-task: top5-2026-10-17
tx-scope: ARCHITECTURE.md (new file)
tx-intent: add top-level ARCHITECTURE.md that maps the 92-crate workspace for newcomers
Add runnable `cargo run --example <name>` demos for the foundation
crates identified in the J-docs audit as lacking examples:

- jcode-app-core/examples/print_build_info.rs
- jcode-config-types/examples/round_trip_enums.rs
- jcode-core/examples/smoke.rs
- jcode-herdr/examples/round_trip_state.rs
- jcode-protocol/examples/serialize_history_message.rs
- jcode-provider-core/examples/smoke.rs
- jcode-swarm-core/examples/round_trip_enums.rs (adds serde_json dev-dep)
- jcode-tool-core/examples/build_schema.rs

Each example is 29-50 LOC, runs cleanly with `cargo run --example`,
and demonstrates the crate's primary public API in a self-contained form.

tx-agent:     jcode
tx-validated: manual
tx-scope:     8 crates examples + swarm-core dev-dep
tx-intent:    resolve the J-docs top-5 'examples' gap
tx-parent:    9e6d3de (rustdoc commit)
Copilot AI balanced review requested due to automatic review settings October 17, 2026 07:37
@codeant-ai

codeant-ai Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

🤖 CodeAnt AI — Review Status

Status Commit Started (UTC) Finished (UTC)
✅ Reviewed your PR e70d9dc Oct 17, 2026 · 07:37 07:45

@codeant-ai

codeant-ai Bot commented Oct 17, 2026

Copy link
Copy Markdown

Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Oct 17, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 22 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 578b6b84-2254-4032-977d-bfcbdbf9f6bf
📥 Commits

Reviewing files that changed from the base of the PR and between 6cf71ed and e70d9dc.

⛔ Files ignored due to path filters: 1
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing: 19
  • ARCHITECTURE.md
  • README.md
  • crates/jcode-app-core/examples/print_build_info.rs
  • crates/jcode-config-types/examples/round_trip_enums.rs
  • crates/jcode-config-types/src/lib.rs
  • crates/jcode-core/examples/smoke.rs
  • crates/jcode-herdr/examples/round_trip_state.rs
  • crates/jcode-protocol/examples/serialize_history_message.rs
  • crates/jcode-protocol/src/lib.rs
  • crates/jcode-provider-core/examples/smoke.rs
  • crates/jcode-provider-core/src/lib.rs
  • crates/jcode-swarm-core/Cargo.toml
  • crates/jcode-swarm-core/examples/round_trip_enums.rs
  • crates/jcode-swarm-core/src/lib.rs
  • crates/jcode-tool-core/examples/build_schema.rs
  • crates/jcode-tool-core/src/lib.rs
  • docs/ENVIRONMENT.md
  • scripts/docs/build_env_table.py
  • scripts/docs/jcode_env.lst
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@codeant-ai codeant-ai Bot added the size:XXL This PR changes 1000+ lines, ignoring generated files label Oct 17, 2026
Comment on lines +32 to +43
/// How a transcript message should be merged into the running
/// conversation history.
///
/// Used by the protocol's inter-session handoff path so that a session
/// resuming from a snapshot can either
/// [`Insert`](TranscriptMode::Insert) at an arbitrary position,
/// [`Append`](TranscriptMode::Append) to the tail,
/// [`Replace`](TranscriptMode::Replace) a previous message (used for
/// stream rescans and mid-turn correction), or
/// [`Send`](TranscriptMode::Send) (default — leaves history
/// untouched and just transmits the new message). The wire form is
/// snake_case.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggestion: TranscriptMode controls how transcript text changes the TUI input buffer, not conversation history; this description could lead protocol clients to update the wrong state.

Assessment: 🟠 Major · 🔁 Occurrence: Sometimes · 🏷️ Docstring mismatch

Use CodeAnt Skill Fix in Cursor Fix in VSCode Claude

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** crates/jcode-protocol/src/lib.rs
**Line:** 32:43
**Comment:**
	*Docstring Mismatch: `TranscriptMode` controls how transcript text changes the TUI input buffer, not conversation history; this description could lead protocol clients to update the wrong state.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

Comment on lines +131 to +132
/// - `field` is the JSON Schema for the input — the host must inspect
/// this (not the `intent`) to pick the right widget.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggestion: field is a form configuration object, not a JSON Schema; hosts following this contract may parse it incorrectly and fail to choose the right widget.

Assessment: 🟠 Major · 🔁 Occurrence: Rarely · 🏷️ Api mismatch

Use CodeAnt Skill Fix in Cursor Fix in VSCode Claude

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** crates/jcode-tool-core/src/lib.rs
**Line:** 131:132
**Comment:**
	*Api Mismatch: `field` is a form configuration object, not a JSON Schema; hosts following this contract may parse it incorrectly and fail to choose the right widget.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

@codeant-ai

codeant-ai Bot commented Oct 17, 2026

Copy link
Copy Markdown

CodeAnt Nitpicks

13 code suggestions

1. Manager leaves bash unblocked, so it can still run build commands despite this documented restriction; the runtime check only blocks the named tools.

Docstring mismatch · crates/jcode-config-types/src/lib.rs:66-70


2. The tool times out with an error instead of deferring the request, so hosts relying on automatic deferral lose the request.

Docstring mismatch · crates/jcode-tool-core/src/lib.rs:135-136


3. jcode-app-core and jcode-config-types now contain examples, so this gap list falsely says they lack examples and directs readers to missing docs.

Comment mismatch · ARCHITECTURE.md:267-271


4. This intra-doc link targets SwarmRole inside jcode-config-types, where no such item exists, so rustdoc cannot resolve the coordinator link.

Api mismatch · crates/jcode-config-types/src/lib.rs:71


5. new_memorable_session_id returns a single-word memorable name, so this description promises a format the API does not produce.

Docstring mismatch · crates/jcode-core/examples/smoke.rs:6-7


6. This invocation omits HERDR_ENV=1, which HerdrEnv::capture requires for active; therefore is_valid remains false despite the other values.

Api mismatch · crates/jcode-herdr/examples/round_trip_state.rs:18-23


7. This says Provider only covers streaming completion and identity metadata, but the trait also exposes model routing, image support, auth hooks, and transport controls.

Docstring mismatch · crates/jcode-provider-core/src/lib.rs:87-89


8. SwarmLifecycleStatus has 13 named variants plus Other(String), not 10, so this description falsely presents the listed states as the full lifecycle.

Docstring mismatch · crates/jcode-swarm-core/examples/round_trip_enums.rs:6-8


9. Other role strings are serialized verbatim, not lowercased, so this claim gives consumers the wrong wire format for custom roles.

Docstring mismatch · crates/jcode-swarm-core/src/lib.rs:100


10. The annotation promises dict values, but the function returns lists of entries per section, giving type-checked callers the wrong result shape.

Type error · scripts/docs/build_env_table.py:166


11. This classifies every _key setting as a keybinding; JCODE_BING_API_KEY is an API credential, so the generated description is wrong.

Logic error · scripts/docs/build_env_table.py:246


12. The checked-in list exists, so normal runs skip the workspace scan and silently omit JCODE variables added after this snapshot.

Incomplete implementation · scripts/docs/build_env_table.py:355-357


13. This is a prefix, not a complete environment variable; including it creates a nonexistent catalog entry and inflates the documented count.

Logic error · scripts/docs/jcode_env.lst:86

@codeant-ai

codeant-ai Bot commented Oct 17, 2026

Copy link
Copy Markdown

CodeAnt PR Risk: Medium Risk

  • The PR needs a manual documentation check before approval.
  • Verify that TranscriptMode describes changes to the TUI input buffer, not conversation history.
  • Confirm whether ElicitRequest.field is a JSON Schema or form configuration before documenting how hosts should interpret it.

Assessed commit: e70d9dc2432c

KooshaPari added a commit that referenced this pull request Oct 17, 2026
…HITECTURE.md, 8 examples) (#114)

Squash-merged from origin/docs/top5-2026-10-17.

tx-agent:     jcode
tx-validated: manual
tx-scope:     docs/top5-2026-10-17
tx-intent:    forward-path 2026-10-17 batch merge (top-5 docs)
tx-pr:        114
@KooshaPari

Copy link
Copy Markdown
Owner Author

Squash-merged into master via the forward-path 2026-10-17 batch (see commit on master). Closing as completed.

@KooshaPari KooshaPari closed this Oct 17, 2026
KooshaPari added a commit that referenced this pull request Oct 17, 2026
…ash commits)

5 of 6 audited forward-path PRs squash-merged into master via the
2026-10-17 batch (security, PR94 blockers, cherry-picks, stdin, println,
docs in priority order). 30 files / +2,900 / -78 LOC across the batch.

Master pre-batch:  3f4746e
Master post-batch: 521c66e

Per-PR squash SHAs:
  #108 -> 827ff9d  (cherry-pick from 17632a2b0)
  #109 -> 2f29ed0  (cherry-pick from 365d0a13a)
  #111 -> a1e19e5  (1 add/add conflict resolved: docs/GOOGLE_GUIDED_SETUP.md)
  #112 -> no-op      (rustls patch already in master; PR closed)
  #113 -> 7fdbe2f  (landed at cycle start; file-level cherry-pick of
                       update_product.rs only)
  #114 -> 521c66e

Source artifacts (canonical): phenotype-registry/audits/kcode-fork-forward-path-2026-10-17/
This directory: docs/audits/2026-10-17-forward-path-batch/  (HTML + PDF + README)

tx-agent:     jcode
tx-validated: manual
tx-scope:     docs/audits/2026-10-17-forward-path-batch/
tx-intent:    persist forward-path batch deliverables in source repo
tx-pr:        115
KooshaPari added a commit that referenced this pull request Oct 17, 2026
…i-compatible) (#101)

The README's 'Supported provider' section previously conflated the
openai-compatible profile list (30+ named services) with native
first-class provider integrations (11 adapter crates). This created
a parity impression the code does not match — 'azure' was grouped
with 'claude/openai' as 'Native / first-party' alongside genuine
adapters, and 'cursor/antigravity' were lumped in with named
profiles.

This rewrites the section as a two-tier description:
  - 11 first-class adapter crates under crates/jcode-provider-*/
    (anthropic, openai, gemini, copilot, openrouter, bedrock,
    antigravity, claude-cli, cursor, grok-build, forgecode)
  - the openai-compatible profile harness with its 30+ named
    built-ins, plus azure (jcode-azure-auth + openai-compat
    runtime) and the local/self-hosted set

Reframes without removing the openai-compatible list. Heading
becomes 'Provider surface' to match the new framing.

Cherry-picked from origin/fix/e-readme-provider-count @ e83a596
(file-level only, KCode fork header from #114 preserved).

Audit reference: E-usability.md, finding 'README's 40-provider
claim sets false expectations.'

tx-agent:     jcode
tx-validated: manual
tx-scope:     README.md
tx-intent:    stop the README from setting false expectations about provider count
tx-pr:        101
@KooshaPari KooshaPari reopened this Nov 5, 2026
@sonarqubecloud

sonarqubecloud Bot commented Nov 5, 2026

Copy link
Copy Markdown

@KooshaPari

Copy link
Copy Markdown
Owner Author

Closing under the host-ops closure audit (2026-11-11): the same change already landed on master (matching commit subject); this PR is the leftover branch. The branch docs/top5-2026-10-17 is preserved on the remote, so the work is recoverable with git fetch origin docs/top5-2026-10-17 or by reopening this PR. Nothing was deleted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XXL This PR changes 1000+ lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants