Add system identity and default skills to RAG context#32
Conversation
|
@coderabbitai review |
There was a problem hiding this comment.
Actionable comments posted: 6
🤖 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 `@README.md`:
- Line 50: Update the README entry titled "System identity" to clarify that the
system.md is required when preparing a session rather than strictly at startup:
change the phrase "Required at startup (created by `openheim init`)." to
something like "Required when preparing a session (created by `openheim init`)."
Also adjust the identical phrasing at the other occurrence around line 182 to
match, and mention `prepare()`/session setup to align the docs with
implementation.
- Around line 83-89: Replace the user-facing example that runs "cargo run --
init" with the installed-binary invocation "openheim init" in the Quickstart
section of README (update the block containing "cargo run -- init" and the
surrounding explanatory text); leave an optional note for developers that "cargo
run -- init" can be used from a source checkout if you want to keep both
examples, but ensure the primary step for most users after "cargo install
openheim" is "openheim init".
In `@src/client.rs`:
- Line 381: The code currently hardcodes default_skills: vec![] in
build_programmatic, preventing callers using OpenheimClient::builder() from
configuring default skills; add a default_skills field to OpenheimBuilder and a
setter method (e.g., OpenheimBuilder::default_skills(&mut self, skills:
Vec<SkillType>)) and thread that field into build_programmatic so it uses the
builder-provided default_skills instead of vec![], updating the build path in
build_programmatic to read the builder.default_skills value when constructing
the programmatic client.
In `@src/config/mod.rs`:
- Around line 47-52: The error message returned in the config_path.exists()
branch incorrectly claims system.md "has been created" even when no write
occurred; update the logic in src/config/mod.rs (the branch that returns
Err(Error::config(...)) and references config_path.display() and
system_path.display()) to either track whether the earlier write actually
happened (e.g., set a boolean when the write near the earlier write call
succeeds) and use that to choose "has been created" vs "is available at", or
simply change the phrasing to "system.md is available at {}" so it never falsely
claims creation; make the change to the Error::config(...) message only.
In `@src/rag/mod.rs`:
- Around line 88-95: The helper merge_skills currently seeds merged from
defaults.to_vec(), so duplicates already present in defaults are preserved;
change merge_skills to build merged from an empty Vec<String> and iterate over
defaults then session, pushing each entry only if merged.contains(...) is false
(i.e., dedupe both inputs via the same path), ensuring duplicates in
default_skills are removed as well as duplicates across session.
In `@src/rag/prompt.rs`:
- Around line 55-59: The current extraction of system_identity trims the value
(via .map(str::trim)) which removes leading/trailing whitespace from the actual
prompt; change the logic so you only use a trimmed view to test blankness but
keep the original text if present. Concretely, obtain the original &str from
self.system_identity (e.g. let orig = self.system_identity.as_deref()), then set
identity = orig.filter(|s| !s.trim().is_empty()) so the prompt uses the original
string but emptiness is determined on s.trim().
🪄 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: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 54c1fbfa-8320-4c06-8d4f-410054fe5666
📒 Files selected for processing (18)
README.mddocs/architecture.mddocs/configuration.mddocs/skills.mdsrc/client.rssrc/config/client.rssrc/config/config.toml.defaultsrc/config/mod.rssrc/config/resolve.rssrc/config/types.rssrc/mcp/client.rssrc/rag/mod.rssrc/rag/prompt.rssrc/rag/system.rssrc/transport/run.rssrc/transport/stdio.rssrc/transport/ws.rssrc/tui/app.rs
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (18)
📝 WalkthroughWalkthroughSeparates agent system identity into required ~/.openheim/system.md, adds AppConfig.default_skills, implements SystemLoader, refactors PromptBuilder to assemble identity then skills, updates RagContext to merge defaults with session skills and inject system.md first, wires defaults through builders/transports, and updates docs and tests. ChangesSystem Identity and Default Skills Feature
Estimated code review effort 🎯 4 (Complex) | ⏱️ ~75 minutes Possibly related PRs
Poem
\n \n\n
🚥 Pre-merge checks | ✅ 4 | ❌ 1\n\n### ❌ Failed checks (1 inconclusive)\n\n| Check name | Status | Explanation | Resolution |\n| :---------: | :------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| Title check | ❓ Inconclusive | The title \"Better rag\" is vague and generic, using non-descriptive language that does not convey meaningful information about the changeset's primary focus. | Use a more descriptive title that clearly indicates the main change, such as \"Add system identity and default skills to RAG context\" or \"Implement system.md loading and default skills management.\" |\n\n\n \n\n✏️ Tip: You can configure your own custom pre-merge checks in the settings.\n\n✅ Passed checks (4 passed)\n\n| Check name | Status | Explanation |\n| :------------------------: | :------- | :----------------------------------------------------------------------------------- |\n| Description Check | ✅ Passed | Check skipped - CodeRabbit’s high-level summary is enabled. |\n| Docstring Coverage | ✅ Passed | Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. |\n| Linked Issues check | ✅ Passed | Check skipped because no linked issues were found for this pull request. |\n| Out of Scope Changes check | ✅ Passed | Check skipped because no linked issues were found for this pull request. |\n\n✨ Finishing Touches📝 Generate docstrings
Comment |
Summary by CodeRabbit
New Features
openheim initnow generates a system identity templatedefault_skillssetting to auto-load skills each sessionBehavior Changes
Documentation
openheimsubcommands (run, serve, acp, init)