Expand description
Rules + SKILL.md injection for every supported agent, split by concern
(GL#440): content (payloads), targets (agent catalog), detect
(installation checks), write (atomic file surgery), skills (SKILL.md).
This hub owns the shared types and the orchestration entry points.
Content is delegated to core::rules_canonical — all rule text lives
there as pub const sections. Markers (START_MARK, END_MARK,
RULES_VERSION) are also re-exported from canonical.
Re-exports§
pub use crate::core::rules_canonical::END_MARK;pub use crate::core::rules_canonical::RULES_VERSION;pub use crate::core::rules_canonical::START_MARK;
Structs§
Constants§
- GEMINI_
DEDICATED_ CONTEXT_ FILENAME - The
context.fileNameentry registered for Gemini in dedicated mode.
Functions§
- any_
rules_ marker_ present - Returns
trueif a lean-ctx rules marker is present in any supported agent’s rules file. - canonical_
rules_ block - Forwarding functions — content is delegated to
core::rules_canonical. - check_
rules_ freshness - Check if the rules file for a given MCP client is up-to-date.
- collect_
rules_ status - cursor_
mdc_ document - Wrap a rendered rules body in the Cursor mdc frontmatter. The description stays profile-neutral: whether native tools are replaced (Dedicated) or hook-covered (GL #1153) is stated by the body itself.
- expected_
blocks_ by_ target - The canonical rules block lean-ctx would write for each target, keyed by the target’s display name.
- gemini_
dedicated_ rules_ path - host_
guidance_ present - Whether
lean-ctx setuphas left guidance for any host: a rules target, or the instruction-file block of a host that has no rules target (Claude Code’sCLAUDE.md, CodeBuddy’sCODEBUDDY.md, #555). The “run setup” tip needs this wider check:any_rules_marker_presentalone never sees a Claude-only installation. - inject_
all_ rules - inject_
rules_ for_ agent - Inject global rules for a single agent (by CLI key like “opencode”, “cursor”, etc.).
- inject_
rules_ where inject_all_rulesrestricted to the agentsallowsadmits (by agent key).- install_
all_ skills - Install SKILL.md for all detected agents.
Returns
Vec<(display_name, was_new_or_updated)>. - install_
skill_ for_ agent - Install SKILL.md for a specific agent. Returns the installed path.
- install_
skills_ where install_all_skillsrestricted to the agentsallowsadmits.- opencode_
dedicated_ rules_ path - planned_
rules_ files - Rules files a setup run would write for the agents
allowsadmits: the installed tools’ targets plus the Claude Code pointer block. Writes nothing. The real run additionally skips tools whose MCP entry is missing (GH #1435). - planned_
skill_ files - SKILL.md files a setup run would write for the agents
allowsadmits. Writes nothing. - rules_
dedicated_ markdown - rules_
longform_ markdown - Long-form rules for the on-demand project
LEAN-CTX.md(#578). Same config-driven shadow/compression handling as the dedicated render, but the LONGFORM profile with the verbose teaching sections. - rules_
shared_ content