40 Commits

Author SHA1 Message Date
Xavier Pestel 1847b07f7a fix(vibe): address PR review — exit code contract, tests, telemetry, docs
Addresses @aeppling's review on #3391:

Blocking fixes:
- run_vibe now returns Ok(()) on malformed JSON (matches run_droid /
  run_copilot / run_cursor pattern). Prior code violated the exit-code
  contract documented at src/hooks/README.md:100 — a bad payload exited
  non-zero and blocked the agent's command. Fixed via a match on
  serde_json::from_str with a stderr warning fallback.
- Extract run_vibe_inner(input: &str) -> Option<String> from run_vibe so
  the hook contract is unit-testable (mirrors run_droid_inner). Public
  run_vibe becomes a thin stdin/stdout wrapper.
- Add 6 runtime tests exercising the hook contract: bash rewrite happy
  path, non-bash tool passthrough, empty command passthrough, malformed
  JSON returns None, unknown binary passthrough, substitution defers.

Should-fix:
- Telemetry agent detection: add ~/.vibe/hooks.toml to detect_hook_type()
  checks in src/core/telemetry.rs, plus the two test enum arrays so Vibe
  sessions no longer report as 'unknown' in rtk gain history.
- Dead deny arm: add a comment on Host::Vibe in permissions.rs
  documenting that the empty-rules branch is defensive scaffolding for
  when Vibe ships native denylist/allowlist config we can honor.
- Broken link: patch_vibe_hooks_toml skip-message now points at
  https://www.rtk-ai.app/guide/getting-started/supported-agents#mistral-vibe
  instead of a fragment that doesn't resolve.

Nits addressed:
- Install summary no longer prints 'hook installed' when the user chose
  PatchMode::Skip or declined the interactive prompt. patch_vibe_hooks_toml
  now returns a VibeHookPatchOutcome enum (Installed / AlreadyPresent /
  Skipped) and the caller gates the summary on it.
- Document the string-spacing tradeoff on vibe_hooks_toml_has_rtk: a
  reformatted 'name="rtk-rewrite"' would defeat idempotency, acceptable
  because we control the writer and toml_edit round-trip would clobber
  user comments.
- Fix stale line in src/hooks/README.md 'Adding New Functionality':
  hook_check.rs::maybe_warn() only checks the Claude Code hook now,
  not every agent.

Documentation:
- docs/guide/getting-started/supported-agents.md: frontmatter now lists
  Mistral Vibe, drop 'planned' from the intro, tier table row flipped
  from 'Planned (#800)' to 'Rust binary (pre_tool) / Yes', replace the
  ### Mistral Vibe (planned) placeholder with a full user-facing section
  modeled on Factory Droid (install/uninstall commands, hook mechanism,
  permission semantics, idempotency contract).
- hooks/README.md: agent count 9 -> 10, add Vibe entry to Directory
  Structure list, add Vibe row to Supported Agents table, add
  '### Mistral Vibe (Rust Binary)' entry to the JSON Formats section
  showing the pre_tool input shape and rewrite response shape.
- src/hooks/README.md: agent count 5 -> 6, add Vibe row to per-host
  ask-support table.
- README.md: '15 AI coding tools' -> '16'.

No behavior change for existing agents.
2026-08-05 13:55:09 +02:00
Nicolas Le Cam b754b85009 fix(hooks): drop redundant camelCase preToolUse entry from Copilot hook config
rtk init --copilot registered both a PascalCase PreToolUse entry and a
camelCase preToolUse entry in the same rtk-rewrite.json, on the assumption
that VS Code Copilot Chat needs the former and Copilot CLI needs the latter.

Live testing showed Copilot CLI treats PreToolUse/preToolUse as two
independent, sequentially-run hooks — a redundant second `rtk hook copilot`
process spawn per tool call, chaining the first hook's rewrite into the
second's input (confirmed via raw stdin capture, and confirmed independent
of declaration order in the file). Also confirmed Copilot CLI honors the
PascalCase-only schema perfectly well on its own, receiving the same
tool_name/tool_input.command shape either way — so the camelCase entry buys
nothing for Copilot CLI, while adding process overhead and an extra,
harder-to-reason-about execution path.

Drop the camelCase preToolUse entry, keeping the single PascalCase
PreToolUse entry shared by both hosts. Existing installs are not upgraded
automatically — re-running `rtk init --copilot` / `rtk init --global
--copilot` overwrites the old dual-schema file with the new one
(write_if_changed overwrites unconditionally on content diff), verified
by test_copilot_init_upgrades_old_dual_schema_install and
test_copilot_global_install_upgrades_old_dual_schema_install, which seed
the old dual-schema content and assert it gets replaced.
2026-07-27 13:59:47 +02:00
Adrien Eppling f02f5b1f82 docs: keep the cost breakdown diagram in one place
The tree was copied into 11 files, so every future correction to it meant
11 edits in 7 languages. It now lives only in savings-explained.md, which
each of those pages already links to.

The surrounding prose stays: it carries the dilution point in the reader's
own language, which is the part that matters at a glance. Three pages
introduced the diagram with a trailing colon, reflowed into the following
paragraph. TRACKING.md gained the link it was missing.
2026-07-22 19:23:58 +02:00
Adrien Eppling 3f009d188c docs: revert internal and low-value files, drop the two-estimator table
Restore to develop the files where the rescoping added noise without
helping a reader: all of .claude/, the src/ module READMEs that only
described their own filters, ARCHITECTURE.md, TELEMETRY.md, quick-start,
configuration and troubleshooting.

Also drop the "Two estimators, one caveat" table from savings-explained.md.
The page already states that rtk gain estimates bytes/4 and ships no
tokenizer; enumerating the test-side estimator was detail no reader needs.

The user-facing surface keeps the rescoping: READMEs in seven languages,
the guide, hooks, and the analytics and usage pages.
2026-07-22 19:02:16 +02:00
Adrien Eppling c1f6ede36e docs: show the cost breakdown as containment, not a transformation chain
The arrow diagram read as a pipeline where bash output becomes input tokens
which become cost. The real relationship is containment: bash output is
part of input tokens, and input tokens are part of cost alongside output
tokens.

Replace the arrow chain with a tree in all 12 places it appeared, including
the six translated READMEs:

  Cost
  ├─ Input tokens
  │  ├─ Bash output           <- the only part RTK filters
  │  ├─ Your prompt
  │  ├─ System prompt
  │  └─ Conversation history
  └─ Output tokens            <- what the model writes

This also makes the dilution self-evident: RTK shrinks one leaf, so the
effect on the root is bounded by that leaf's share.
2026-07-22 18:52:34 +02:00
Adrien Eppling b1047583c6 docs: lower the filter gate to 20% and trim redundant explainer links
The documented release blocker was ">=60% savings", but the code never
enforced that. 23 of the 63 threshold assertions in src/ already sit below
60% (15, 20, 30, 40 and 50% appear across aws, gh, git, glab and mvn), so
the gate was aspirational rather than real.

Set the floor to 20%, pointing at the existing "Correctness VS Token
Savings" section for the reasoning rather than restating it: a modest, safe
reduction beats an aggressive one that drops information the agent needed.

Descriptive "60-90%" ranges are left alone where they report what filters
actually achieve. Only requirement statements moved to the 20% floor.

Also reduce links to savings-explained.md down to one per file, and only
from root docs and user-facing pages. Removed from docs/contributing/ and
.claude/rules/, where the surrounding text already carries the caveat.
2026-07-22 18:44:50 +02:00
Adrien Eppling a1673f7428 docs: scope savings claims to bash output and document the estimator
RTK was documented as delivering "60-90% token savings", which reads as a
cost reduction. What RTK actually reduces is bash output bytes. Those are
one contributor to input tokens, which are themselves only part of a bill
that also counts output tokens, so the reduction dilutes at every step.

- add docs/guide/resources/savings-explained.md as the canonical explainer:
  the savings chain, both estimators, and what RTK does not reduce
- rescope the headline claim across README (7 languages), the guide, hook
  rules, agent definitions and module READMEs
- relabel per-command tables as bash output reduction, keeping every figure
- document that reported tokens are estimates: rtk gain uses bytes/4
  (src/core/tracking.rs), filter tests use split_whitespace().count().
  Neither is a real tokenizer, so ratios hold but absolute counts do not

Remove figures that had no source: the $3/Mtok constant and its $36
example, the +/-10% tokenization accuracy claim, the 99.5% hook-install
figure, the invented session tables in README and INSTALL, and the 30-50%
parser range.

CHANGELOG is untouched. Shipped release notes stay as a historical record.
2026-07-22 18:33:54 +02:00
aesoft 16a6dabfa9 Update installation.md 2026-07-20 17:04:57 +02:00
Adrien Eppling 4ee1e94000 docs(install): drop rationale from cargo install section 2026-07-20 17:02:06 +02:00
Adrien Eppling 8c7f0dc97f docs(install): pin cargo install to the master release branch 2026-07-20 16:58:58 +02:00
krimvp 3d407426b5 fix(hooks): make Droid verdicts deny-only from explicit lists in all scopes
Drop the hardcoded mirrors of Droid's built-in command lists and stop
emitting permissionDecision entirely. RTK now steps aside only on
explicit commandDenylist/commandBlocklist entries, unioned across all
four settings scopes (user + project, settings.json +
settings.local.json); every other command is rewritten via updatedInput
and the decision is left to Droid's native flow.

Verified against Droid CLI 0.153.1: updatedInput is applied after
Droid's own permission evaluation of the original command, so native
allowlist decisions are unaffected and deny entries fire natively.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SpSp3Arj7fG1XJYhXoCMGC
2026-07-06 23:13:39 +02:00
krimvp 0a032aab10 docs(agents): add Factory Droid to supported-agents guide
Propagates the README Droid documentation to
docs/guide/getting-started/supported-agents.md per review feedback:
frontmatter description, agents table row, and an installation section
covering hooks.json placement and Droid-native permission handling.

Claude-Session: https://claude.ai/code/session_015CvKLxKMnmcvwY5CjHVTF5
2026-07-05 23:12:56 +02:00
Adrien Eppling bbeee4c85e docs(trust): fix README to match silent skip; note global-filter migration 2026-07-01 15:41:54 +02:00
Adrien Eppling 9d3b678242 fix(trust): skip untrusted filters silently on the command path
The warning printed to stderr on every rewritten command, adding tokens; trust is surfaced only in `rtk init`/`rtk trust`.
2026-07-01 14:46:37 +02:00
Adrien Eppling 84f952881b docs: document custom filters + trust in the config guide
Move the user-facing trust docs into docs/guide (config) and out of CODING_PRACTICES.
2026-07-01 13:31:51 +02:00
Nicolas Le Cam 67a5958459 doc(init): fix documentation inconsistencies arount rtk init
Fixes #213
2026-05-30 18:16:41 +02:00
aesoft e3ad973617 fix(copilot-cli): use user-level instruction for -g
-g was missing user level instructions which are available for copilot
2026-05-29 09:16:22 +02:00
Adrien Eppling 4b0bbf269b feat(hook): --global Copilot install + transparent rewrite via modifiedArgs 2026-05-26 19:56:04 +02:00
Adrien Eppling 84b703d7d0 feat(hook): wire Copilot into uninstall, telemetry, and discover 2026-05-25 22:19:58 +02:00
Adrien Eppling 8fb29e2f75 fix(hook): emit Copilot CLI-compatible hook config + strip BOM on Windows 2026-05-25 22:19:57 +02:00
gitbluf cb1661e68d feat(init): remove --pi flag, canonicalize Pi install to --agent pi
chore: sync the codebase after mergew
2026-05-11 21:46:46 +02:00
Marko Petrovic 1ef5b10f73 Merge branch 'develop' into develop 2026-05-11 20:17:22 +02:00
Kayphoon 9d3b99dec8 feat(hermes): add rtk integration
Signed-off-by: Kayphoon <109347466+Kayphoon@users.noreply.github.com>
2026-05-12 00:30:39 +08:00
gitbluf a4caafad71 chore: docs cleanup 2026-05-06 18:51:39 +02:00
gitbluf b2a3ad9443 feat: rm rtk awareness injection 2026-05-06 18:44:27 +02:00
gitbluf d6e27527ea refactor: handling of uninstallation 2026-05-06 16:38:01 +02:00
hed0rah 2f185a4749 docs(init): document --dry-run in quick-start guide
Adds a "Preview without writing" subsection under Step 1 covering the
--dry-run flag, -v interaction for content preview, that telemetry
consent is skipped, and the --show conflict. Required by CONTRIBUTING.md
section 4 (new features need documentation).
2026-04-26 17:53:44 -04:00
aesoft 2e401ac38f fix(docs): add missing docs for exclude commands patterns 2026-04-19 13:59:03 +02:00
Florian BRUNIAUX 4c9b528206 docs: Adrien review — hierarchy, counts, consistency, gaps
Hierarchy:
- Move troubleshooting.md and what-rtk-covers.md to guide/resources/
- Add guide/resources/telemetry.md (adapted from docs/TELEMETRY.md,
  user-facing: consent, opt-out, GDPR rights — without internal sections)

Content fixes:
- Remove all hardcoded counts (9 ecosystems, 12 agents, 60+, 7 more)
  replaced with qualitative language throughout
- Unify DB filename: tracking.db → history.db everywhere
  (canonical: src/core/constants.rs HISTORY_DB)
- installation.md: replace bare `cargo install rtk` with warning +
  explicit git URL to avoid Rust Type Kit name collision
- supported-agents.md: remove hardcoded agent count
- quick-start.md: remove hardcoded ecosystem list, link to what-rtk-covers

New content:
- gain.md: add --quota section explaining pro/5x/20x tier meanings
- gain.md: add callout linking to discover.md (find missed savings)
- index.md: add "Analyze your usage" section (rtk discover, rtk session)
- configuration.md: clarify ignore_dirs/ignore_files scope, add prose
  link to telemetry.md
- what-rtk-covers.md: clarify --ultra-compact vs git -u short flag conflict

Cross-references:
- All internal links updated for new resources/ paths
- index.md: link to troubleshooting, telemetry, what-rtk-covers, analytics
- discover.md: updated relative link to troubleshooting

README:
- Add Core team section (Patrick Szymkowiak, Florian Bruniaux, Adrien Eppling)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-14 14:17:58 +02:00
aesoft 9e96caa0a1 Merge pull request #355 from KuSh/pnpx+dlx
feat(discover): handle more npm/npx/pnpm/pnpx patterns
2026-04-13 20:31:12 +02:00
Florian BRUNIAUX 4093d5c13d Merge pull request #1094 from rtk-ai/docs/windows-instructions 2026-04-13 09:26:05 +02:00
Nicolas Le Cam 45938b2a4d feat(js): distinguish between jest and vitest and don't rewrite npm test commands as we don't know which test framework is used under the hood
Signed-off-by: Nicolas Le Cam <niko.lecam@gmail.com>
2026-04-12 22:03:39 +02:00
aesoft cce04811c7 Update troubleshooting.md 2026-04-10 14:22:19 +02:00
Patrick szymkowiak b73506867e docs: add Windows setup instructions and troubleshooting
Windows users downloading the pre-built binary had no guidance —
double-clicking rtk.exe flashes a terminal and exits immediately.

- README: add warning under Windows binary link, add full Windows section
  with WSL vs native comparison table
- installation.md: add pre-built binaries section with Windows note
- supported-agents.md: add Windows support section (CLAUDE.md fallback)
- troubleshooting.md: add "double-click does nothing" and "hook not working"
  entries for Windows users

Prompted by Discord user report (PedroLyra).

Signed-off-by: Patrick szymkowiak <patrick.szymkowiak@innovtech.eu>
2026-04-09 09:30:58 +02:00
yosoyepa d0a3797ec5 feat(init): add native support for Kilo Code and Google Antigravity
Add rtk init --agent kilocode and rtk init --agent antigravity commands.

Kilo Code: installs .kilocode/rules/rtk-rules.md (project-scoped)
Google Antigravity: installs .agents/rules/antigravity-rtk-rules.md (project-scoped)

Both follow the same prompt-level guidance pattern as Cline and Windsurf,
using rules files that instruct the agent to prefix shell commands with rtk.
2026-04-08 15:37:29 -05:00
Florian BRUNIAUX 6e55f8984c docs: address Adrien's review — structure, missing content, agents
Structure:
- Move docs/README.md → .github/docs-pipeline-contract.md (interface
  contract is not user-facing content)
- Rewrite docs/guide/index.md as a proper landing page with RTK intro,
  flow diagram, and navigation (replaces empty nav stub)
- Move configuration.md → getting-started/configuration.md (sidebar order 4,
  after supported-agents per Adrien's suggestion)

Missing content:
- Add docs/guide/analytics/discover.md: rtk discover (missed savings analysis)
  and rtk session (adoption tracking across sessions)
- Add uninstall instructions to installation.md (rtk init -g --uninstall,
  cargo uninstall, brew uninstall)
- Add global flags section to what-rtk-covers.md (-u/--ultra-compact,
  -v/--verbose)
- Add rtk smart command to what-rtk-covers.md Files section

Agents:
- Update supported-agents.md: 10 agents (was 9)
- Add OpenClaw (TypeScript plugin, before_tool_call)
- Add Mistral Vibe (planned, issue #800)
- Fix GitHub Copilot: VS Code = transparent rewrite via PreToolUse,
  Copilot CLI = deny-with-suggestion (upstream limitation)

Signed-off-by: Florian BRUNIAUX <florian@bruniaux.com>
2026-04-06 11:16:24 +02:00
Florian BRUNIAUX a94e9493b3 docs: consolidate to user-facing guide, remove duplicates and legacy flat docs
- Remove docs/reference/ (10 files): duplicates CONTRIBUTING.md, SECURITY.md,
  ARCHITECTURE.md, src/*/README.md (distributed pattern from PR #869)
- Remove docs/architecture/ (5 files): duplicates ARCHITECTURE.md ADRs and diagrams
- Remove docs/guide/commands/ (12 files): showed rtk <cmd> syntax users never type
  (hooks rewrite transparently); content was derived from FEATURES.md
- Remove docs/guide/filters/ (2 files): contributor content, belongs with src/filters/
- Remove docs/guide/analytics/discover.md, economics.md: implementation details
- Remove legacy flat docs/ (6 files): FEATURES.md (FR), TECHNICAL.md, TROUBLESHOOTING.md,
  AUDIT_GUIDE.md, tracking.md, filter-workflow.md — all superseded by guide/ rewrites
  or codebase distributed docs

- Add docs/guide/what-rtk-covers.md: replaces 12 command pages with one user-facing
  overview of 60+ commands by ecosystem, no rtk <cmd> syntax
- Enrich docs/guide/analytics/gain.md: absorb advanced workflows from AUDIT_GUIDE.md
  (CI integration, pandas analysis, cron snapshots)
- Adapt docs/guide/getting-started/quick-start.md: remove rtk <cmd> examples,
  explain hook transparency instead
- Update docs/README.md: single-tab contract, pointer to codebase for technical docs
- Update docs/guide/index.md: clean navigation matching final structure
- Add Mermaid diagrams to src/filters/README.md: build pipeline + filter lookup
  (preserves content from filter-workflow.md in its natural home)

Result: 9 files in docs/guide/ (was 39), zero legacy flat docs, zero duplicates.
Codebase distributed docs (ARCHITECTURE.md, CONTRIBUTING.md, src/*/README.md)
remain the source of truth for technical and contributor content.

Signed-off-by: Florian BRUNIAUX <florian@bruniaux.com>
2026-04-05 21:26:07 +02:00
Florian BRUNIAUX 974db2ff0b docs(phase-4): complete reference, architecture tabs and remaining commands
Guide — 10 new command and analytics pages:
- commands/go.md: go test (NDJSON), golangci-lint
- commands/ruby.md: rspec, rubocop, rake
- commands/dotnet.md: dotnet build/test, binlog, format
- commands/containers.md: docker ps/images/logs/compose, kubectl pods/services/logs
- commands/github-cli.md: gh pr/issue/run, Graphite gt commands
- commands/data.md: json, env, log, curl, wget, aws, psql, summary
- commands/utilities.md: proxy passthrough, global flags, RTK_DISABLED
- filters/creating-filters.md: TOML DSL guide, field reference, inline tests
- analytics/discover.md: rtk discover — missed savings analysis
- analytics/economics.md: rtk cc-economics — dollar savings vs ccusage

Reference tab (9 pages):
- contributing/guide.md: design philosophy, PR process, TOML vs Rust decision
- contributing/security.md: vulnerability reporting, dangerous patterns, dep criteria
- contributing/coding-standards.md: Rust rules, error handling, lazy_static, fallback pattern
- contributing/testing.md: snapshot tests, token accuracy, cross-platform, benchmarks
- internals/command-routing.md: 6-phase lifecycle, exit codes, verbosity, module map
- internals/filter-pipeline.md: 12 filtering strategies, TOML stages, savings by ecosystem
- internals/tracking-system.md: SQLite schema, data flow, token estimation, Tracker API
- internals/hook-engine.md: rewrite registry, compound commands, exit code contract, rtk init
- toml-dsl/specification.md: complete field reference, pipeline order, build compilation

Architecture tab (4 pages):
- diagrams/command-flow.md: end-to-end Mermaid — hook → RTK → LLM
- diagrams/filter-pipeline.md: build pipeline + 8-stage runtime Mermaid
- decisions/why-no-async.md: ADR — single-threaded, <10ms startup constraint
- decisions/proxy-architecture.md: ADR — why CLI proxy over aliases/LD_PRELOAD/hooks-only

All pages carry valid frontmatter (title, description, sidebar.order).
No existing files modified.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Florian BRUNIAUX <florian@bruniaux.com>
2026-04-05 00:18:59 +02:00
Florian BRUNIAUX 25438b29ae docs(guide): add 11 Phase 1 guide pages — full MVP content
Creates the complete user-facing guide for the docs website:

Getting started:
- quick-start.md: 5-minute walkthrough (init, first commands, rtk gain)
- supported-agents.md: Claude Code, Cursor, Copilot, Gemini, Cline, Windsurf,
  Codex, OpenCode — integration tiers, install commands, graceful degradation

Commands (adapted from FEATURES.md, English, --help-first format):
- git.md: status/log/diff/show/add/commit/push/pull/branch + gh CLI
- cargo.md: test/nextest/build/check/clippy/install + generic test/err wrappers
- files.md: ls/read/grep/find/diff/wc/smart with before/after examples
- javascript.md: vitest/playwright/tsc/eslint/prettier/next/pnpm/npm/npx/prisma
- python.md: pytest/ruff/mypy/pip/deps

Reference:
- filters/using-filters.md: 8-stage pipeline, lookup priority, TOML DSL reference,
  Mermaid diagram (adapted from docs/filter-workflow.md)
- analytics/gain.md: rtk gain flags, daily/weekly/monthly breakdowns, export
  formats, token estimation, database management (from docs/AUDIT_GUIDE.md)
- configuration.md: full config.toml reference, env vars, tee system, telemetry
- troubleshooting.md: common issues and fixes (from docs/TROUBLESHOOTING.md)

All pages carry valid frontmatter (title, description, sidebar.order).
No existing files modified.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Florian BRUNIAUX <florian@bruniaux.com>
2026-04-05 00:09:14 +02:00
Florian BRUNIAUX 9c9879c2da docs: add interface contract and Phase 0 stubs for docs reorganization
Creates docs/README.md (interface contract defining 3-tab structure,
required frontmatter, and conventions) and 4 stub pages with valid
frontmatter for docs/guide/, docs/reference/, and docs/architecture/.
These are the prerequisites for the prepare-docs.mjs pipeline (Plan B)
and for Adrien's Phase 1 content work.

No existing files modified.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Florian BRUNIAUX <florian@bruniaux.com>
2026-04-04 23:54:16 +02:00