ravi-rules
/ravi-rules
Use when creating, reviewing, or debugging `.ravi/rules` runtime prompt rules: - adding workspace/fleet rules that must be injected into built system prompts - diagnosing missing or duplicated `## Ravi Rules` sections - changing runtime prompt assembly around rules, AGENTS.md, or provider fallbacks - deciding whether a rule belongs in `.ravi/rules`, AGENTS.md, a spec, or an agent prompt
- Author
- filipexyz ↗
- Repository
- ravi ↗
- Licence
- MIT
- Last repository change
- 27.10.2026
Assessment and security
- Files in this package
- 1
- Scripts
- 0
- HTML comments
- 0
- URLs in SKILL.md
- 0
No signals detected. Repository changed on 27.10.2026, without references to retired models or APIs.
MIT, open: use and modify while retaining author attribution.
What it does and when to use it
Use when creating, reviewing, or debugging `.ravi/rules` runtime prompt rules: - adding workspace/fleet rules that must be injected into built system prompts - diagnosing missing or duplicated `## Ravi Rules` sections - changing runtime prompt assembly around rules, AGENTS.md, or provider fallbacks - deciding whether a rule belongs in `.ravi/rules`, AGENTS.md, a spec, or an agent prompt
Original author description
Use when creating, reviewing, or debugging `.ravi/rules` runtime prompt rules: - adding workspace/fleet rules that must be injected into built system prompts - diagnosing missing or duplicated `## Ravi Rules` sections - changing runtime prompt assembly around rules, AGENTS.md, or provider fallbacks - deciding whether a rule belongs in `.ravi/rules`, AGENTS.md, a spec, or an agent prompt
How it works
- Contrato Do CLI
- Mental Model
- Loader Contract
- Import Contract
- Editing Guidance
- Validation
SKILL.md preview
---
name: ravi-rules
description: |
Use when creating, reviewing, or debugging `.ravi/rules` runtime prompt rules:
- adding workspace/fleet rules that must be injected into built system prompts
- diagnosing missing or duplicated `## Ravi Rules` sections
- changing runtime prompt assembly around rules, AGENTS.md, or provider fallbacks
- deciding whether a rule belongs in `.ravi/rules`, AGENTS.md, a spec, or an agent prompt
---
# Ravi Rules
`.ravi/rules` is the Ravi-owned source for workspace runtime rules that must be injected into the built system prompt.
Before changing this area, read the normative spec:
```bash
bin/ravi specs get runtime/prompt-rules --mode rules --json
```
## Contrato Do CLI
Rode com `--json` sempre que for decidir programaticamente. Com `--json`, falha sai em envelope `{success:false, op, error:{code, message, retryable, suggestedAction, acceptedValues?, suggestions?}}` (spec: `cli/rules`).
Taxonomia de saída:
- `0` sucesso — inclusive o dry-run nativo do `import` (o plano vem no payload em `candidates`, com verbos `would-create`\`would-overwrite`).
- `2` erro de uso: provider inválido em `sources`\`import`. O envelope traz `acceptedValues` (`all`, `claude`, `agents`) e `suggestions` — corrija o positional, não insista.
- Não existe `RULE_NOT_FOUND`: o domínio não tem lookup por regra individual (declarado na spec).
Freio deste domínio é NATIVO, em dois estágios — `import` NÃO tem `--execute`:
1. Sem `--write`: dry-run, nada é criado (exit 0 com o plano).
2. Com `--write` mas sem `--force`: cria novos e PULA arquivos já importados (`skippedExisting`).
3. Só `--write --force` sobrescreve regras importadas existentes — confirme o overwrite antes.
Compact mode: `rules sources` aceita `--fields a,b,c` (ex.: `--fields provider,exists`).
Checklist antes de responder sobre rules:
- Tratei "import não escreveu nada" como freio nativo (faltou `--write`) e não como bug?
- Confirmei que o overwrite é intencional antes de adicionar `--force`?
- Usei `acceptedValues` do envelope para corrigir o provider em vez de repetir a chamada?
## Mental Model
- `AGENTS.md` describes workspace development instructions.
- `.ravi/rules` describes runtime/fleet rules that should be injected into session prompts.
- Agent `systemPromptAppend` specializes one configured agent.
- Provider settings such as `~/.claude/rules` are not the Ravi source of truth.
- Provider folders such as `.claude/rules` and `.agents/rules` are import sources only. Runtime prompt assembly must read `.ravi/rules`.
The runtime loads rules from the effective session cwd:
```text
<session-cwd>/.ravi/rules/
```
Each non-empty supported file is rendered under one final prompt section:
```markdown
## Ravi Rules
### some-rule.md
...
```
## Loader Contract
- Read recursively.
- Emit deterministic relative-path order.
- Ignore hidden entries such as `.gitkeep` and `.DS_Store`.
- Ignore empty files.
- Accept `.md`, `.markdown`, `.txt`, and extensionless text files.
- Do not inject binary files or arbitrary generated artifacts.
- Keep one top-level `## Ravi Rules` section.
- Place the section after `Workspace Instructions` and before `Agent Instructions`.
- Preserve trace metadata as `id=ravi.rules`.
## Import Contract
Use the CLI to migrate rules from provider-owned folders into Ravi-owned rules:
```bash
ravi rules sources all --json
ravi rules import all --write --json
```
Supported import sources:
- project Claude rules: `<cwd>/.claude/rules`
- project agents-folder rules: `<cwd>/.agents/rules`
- user Claude rules: `~/.claude/rules` only with `--include-user`
- user agents-folder rules: `~/.agents/rules` only with `--include-user`
Imported files must land under:
```text
<cwd>/.ravi/rules/imported/<provider>/<scope>/<relative-rule-path>
```
Rules:
- Import dry-runs unless `--write` is passed.
- User-level imports require `--include-user`.
- Existing imported files are skipped unless `--force` is passed.
- Import summaries must not print raw rule content in JSON.
- Import uses the same hidden/empty/unsupported/binary filtering as runtime loading.
## Editing Guidance
Put a rule in `.ravi/rules` when it is:
- operational behavior expected across sessions in that workspace;
- stable enough to be reviewed as repository content;
- useful in both task sessions and direct sessions;
- not specific to a single agent identity.
Put it somewhere else when:
- it is a codebase contributor convention: use `AGENTS.md`;
- it is a durable architectural invariant: use `.ravi/specs`;
- it is specific to one agent: use that agent's prompt/config;
- it is private user preference: keep it out of the repo.
Never store secrets, tokens, private keys, or credentials in `.ravi/rules`.
## Validation
After changing loader behavior or prompt ordering, run:
```bash
bun test src/runtime/runtime-system-prompt.test.ts src/runtime/codex-provider.test.ts src/runtime/session-trace.test.ts
bun test src/cli/commands/rules.test.ts
bun run typecheck
bun run build
```
If task behavior is involved, also run:
```bash
bun test src/tasks/service.test.ts src/tasks/profiles.test.ts
```
Versions
The database has no other skills named ravi-rules.
Database snapshot: 13.11.2026 · package version 8eb155d06fb4 (SHA-256 digest of the entire package)
Downloads in the last 30 days: 0 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 100prompt-optimization
Guides building, reviewing, and optimizing system prompts and prompt templates for LLMs. Use when creating system prompts, writing prompt templates, optimizing prompt structure, reducing prompt token usage, compressing prompts, improving prompt clarity, reviewing prompts for… - 100tool-prompt-optimization
Optimize the description prompts an AI agent reads to learn its built-in tools (the `.md` files under prompts/tools/). Two halves: (1) measure how much of a prompt is already inferable from the tool's JSON parameter schema + name, to prune redundancy with evidence; (2) house… - 100agent-prompt
Reference guide for writing effective agent prompts and skills. Use when creating new skills, reviewing prompt quality, or understanding Warden's prompt architecture. - 100skill-writing
Use when deciding 'should this be a skill or a rule?', creating/improving/reviewing agent skills, SKILL.md frontmatter, or procedure sections — even without saying 'skill-writing'. - 100rule-writing
Use when creating or editing a rule in src/rules/ — trigger wording, always vs auto classification, size budget — even when the user just says 'add a rule for X'. - 100manage-rules
Inspect, audit, enable, or disable project live-rules. Use to list rules, check active instructions, explain an injected rule, or recover an atomic manifest.