rails-ai-bridge 3.4.0 → 3.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.reek.yml +2 -0
- data/AGENTS.md +3 -3
- data/CHANGELOG.md +155 -0
- data/CLAUDE.md +3 -3
- data/README.md +134 -40
- data/docs/BEST_PRACTICES.md +15 -13
- data/docs/GUIDE.md +184 -41
- data/docs/devin-setup.md +264 -0
- data/docs/gem-general-improvements.md +162 -0
- data/docs/offline-mode.md +121 -0
- data/docs/port-registry-resolution.md +172 -0
- data/docs/registry-resolution.md +274 -0
- data/docs/skill-registry-guide.md +361 -0
- data/lib/generators/rails_ai_bridge/help/help_generator.rb +32 -0
- data/lib/generators/rails_ai_bridge/install/command_help.rb +48 -0
- data/lib/generators/rails_ai_bridge/install/install_generator.rb +107 -53
- data/lib/generators/rails_ai_bridge/install/profile_resolver.rb +2 -2
- data/lib/rails_ai_bridge/assistant_formats_preference.rb +1 -1
- data/lib/rails_ai_bridge/config/registry.rb +99 -0
- data/lib/rails_ai_bridge/configuration.rb +7 -2
- data/lib/rails_ai_bridge/engine.rb +11 -0
- data/lib/rails_ai_bridge/registry/frontmatter_parser.rb +80 -0
- data/lib/rails_ai_bridge/registry/pack_definition.rb +23 -0
- data/lib/rails_ai_bridge/registry/pack_detector.rb +107 -0
- data/lib/rails_ai_bridge/registry/pack_resolver.rb +202 -0
- data/lib/rails_ai_bridge/registry/rake_presenter.rb +93 -0
- data/lib/rails_ai_bridge/registry/registry_manifest.rb +52 -0
- data/lib/rails_ai_bridge/registry/resolver.rb +246 -0
- data/lib/rails_ai_bridge/registry/resolver_cache.rb +69 -0
- data/lib/rails_ai_bridge/registry/skill_source_resolver.rb +299 -0
- data/lib/rails_ai_bridge/registry/source_parser.rb +102 -0
- data/lib/rails_ai_bridge/registry/tile_manifest.rb +129 -0
- data/lib/rails_ai_bridge/registry/truncatable.rb +37 -0
- data/lib/rails_ai_bridge/registry.rb +105 -0
- data/lib/rails_ai_bridge/serializers/context_file_serializer.rb +2 -2
- data/lib/rails_ai_bridge/serializers/providers/{windsurf_rules_serializer.rb → devin_rules_serializer.rb} +10 -10
- data/lib/rails_ai_bridge/serializers/providers/{windsurf_serializer.rb → devin_serializer.rb} +6 -6
- data/lib/rails_ai_bridge/serializers/providers/factory.rb +2 -2
- data/lib/rails_ai_bridge/server.rb +3 -1
- data/lib/rails_ai_bridge/tasks/rails_ai_bridge.rake +81 -4
- data/lib/rails_ai_bridge/tools/list_registry.rb +170 -0
- data/lib/rails_ai_bridge/tools/resolve_skill.rb +141 -0
- data/lib/rails_ai_bridge/version.rb +1 -1
- data/lib/rails_ai_bridge.rb +3 -0
- data/rails-ai-bridge.gemspec +2 -2
- data/server.json +1 -1
- metadata +31 -17
- data/docs/roadmap-context-assistants.md +0 -88
- data/docs/roadmap-mcp-v2.md +0 -45
- data/docs/roadmaps.md +0 -84
- data/resume.md +0 -181
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c78af79aba88ce31b9ea2d0f0c2de1e14782f5a0d2fbc9ccae9a879c86020ad8
|
|
4
|
+
data.tar.gz: 736de35b4fa3413752e77b3ebc37abf5628c697c7855561985031d7a06b53783
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f7204bde6b731db642cedb0d3748e413f3c8f6496633328f1450412fdce6aa1127ca7fbaef443b061068f8d66177c5878f35e72a4bd75b21f8ec20f496e6c261
|
|
7
|
+
data.tar.gz: 93f710a0ceeba7a6b55fe6323b22ae1b980424ac301877b13a9d8e2f8e63a064500e5db86db30330b7347649f2774ca9d0655e82704008d568fe4e858e2b33b2
|
data/.reek.yml
CHANGED
|
@@ -459,6 +459,7 @@ detectors:
|
|
|
459
459
|
- RailsAiBridge::Tools::SearchSemantic#self.format_results
|
|
460
460
|
NilCheck:
|
|
461
461
|
exclude:
|
|
462
|
+
- RailsAiBridge::Registry::DeprecatedEntry#removed_in?
|
|
462
463
|
- RailsAiBridge::AssistantFormatsPreference#formats_for_default_bridge_task
|
|
463
464
|
- RailsAiBridge::Config::Introspection#excluded_table?
|
|
464
465
|
- RailsAiBridge::RubydexAdapter#sanitize_index_path
|
|
@@ -523,6 +524,7 @@ detectors:
|
|
|
523
524
|
- RailsAiBridge::Server
|
|
524
525
|
TooManyStatements:
|
|
525
526
|
exclude:
|
|
527
|
+
- RailsAiBridge::Registry::FrontmatterParser#self.extract_frontmatter_lines
|
|
526
528
|
- RailsAiBridge#validate_auto_mount_configuration!
|
|
527
529
|
- RailsAiBridge::AssistantFormatsPreference#formats_for_default_bridge_task
|
|
528
530
|
- RailsAiBridge::AssistantFormatsPreference#write!
|
data/AGENTS.md
CHANGED
|
@@ -9,8 +9,8 @@ structure to AI assistants via the Model Context Protocol (MCP).
|
|
|
9
9
|
- `lib/rails_ai_bridge/configuration.rb` — User-facing config with presets (:standard, :full)
|
|
10
10
|
- `lib/rails_ai_bridge/introspector.rb` — Orchestrates sub-introspectors
|
|
11
11
|
- `lib/rails_ai_bridge/introspectors/` — Built-in introspector classes; `:standard` preset runs **9**, `:full` runs **26** (see `Configuration::PRESETS`). Registry: `Introspector::BUILTIN_INTROSPECTORS` (includes opt-in symbols such as `database_stats`, `non_ar_models` not listed in those presets).
|
|
12
|
-
- `lib/rails_ai_bridge/tools/` —
|
|
13
|
-
- `lib/rails_ai_bridge/serializers/` — Output formatters (Codex, claude_rules, cursor_rules,
|
|
12
|
+
- `lib/rails_ai_bridge/tools/` — 14 built-in MCP tools using the official mcp SDK (hosts can add more via `additional_tools`)
|
|
13
|
+
- `lib/rails_ai_bridge/serializers/` — Output formatters (Codex, claude_rules, cursor_rules, devin, devin_rules, copilot, copilot_instructions, rules, markdown, JSON)
|
|
14
14
|
- `lib/rails_ai_bridge/resources.rb` — MCP resources (static data AI clients read directly)
|
|
15
15
|
- `lib/rails_ai_bridge/server.rb` — MCP server configuration (stdio + HTTP transports)
|
|
16
16
|
- `lib/rails_ai_bridge/middleware.rb` — Rack middleware for auto-mounting MCP HTTP endpoint
|
|
@@ -33,7 +33,7 @@ structure to AI assistants via the Model Context Protocol (MCP).
|
|
|
33
33
|
9. **Introspector presets** — `:standard` (9 core) default, `:full` (26 introspectors; optional extras such as `database_stats`, `non_ar_models`) for power users
|
|
34
34
|
10. **MCP auto-discovery** — `.mcp.json` generated by install generator
|
|
35
35
|
11. **Compact by default** — context files ≤150 lines, MCP tools use `detail` parameter (summary/standard/full)
|
|
36
|
-
12. **Per-tool split rules** — `.Codex/rules/`, `.cursor/rules/`, `.
|
|
36
|
+
12. **Per-tool split rules** — `.Codex/rules/`, `.cursor/rules/`, `.devin/rules/`, `.github/instructions/`
|
|
37
37
|
|
|
38
38
|
## Testing
|
|
39
39
|
|
data/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,161 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- **`git_timeout` for git operations** — `Config::Registry#git_timeout` (default `30` seconds) is
|
|
13
|
+
now passed to `DefaultGitRunner`, which wraps every git subprocess (`clone`, `pull`, `checkout`)
|
|
14
|
+
in `Timeout.timeout`. A slow or unreachable remote can no longer block the calling thread
|
|
15
|
+
indefinitely; a descriptive `RuntimeError` (e.g. `"git clone timed out after 30s"`) is raised
|
|
16
|
+
instead. `DefaultGitRunner#timeout` exposes the configured value for introspection.
|
|
17
|
+
- **`git_pull_ttl` — per-pack pull freshness window** — `Config::Registry#git_pull_ttl` (default
|
|
18
|
+
`86400` seconds = 24 h) controls how often `SkillSourceResolver` issues a `git pull` for an
|
|
19
|
+
already-cached pack. Successive `resolve` calls within the TTL window skip the pull entirely,
|
|
20
|
+
removing the previous behaviour of pulling on every resolver rebuild. Set to `0` to restore
|
|
21
|
+
pull-on-every-resolve. Pull timestamps are tracked in a thread-safe, in-memory `Mutex`-guarded
|
|
22
|
+
hash; they reset when the process restarts.
|
|
23
|
+
- **`checkout_ref` timeout** — `git checkout <ref>` is now also subject to `git_timeout`.
|
|
24
|
+
A `SkillSourceResolver::ResolutionError` is raised on timeout with the ref name and pack source
|
|
25
|
+
in the message.
|
|
26
|
+
- **`Registry::Truncatable` shared module** (`lib/rails_ai_bridge/registry/truncatable.rb`) —
|
|
27
|
+
extracts the `truncate(text, max)` helper that was duplicated between `RakePresenter` and
|
|
28
|
+
`RegistryCatalogFormatter`. Both classes now `include Truncatable` and the private duplicates
|
|
29
|
+
are removed.
|
|
30
|
+
- **`Engine.to_prepare` hook** — the Rails Engine now registers a `config.to_prepare` block that
|
|
31
|
+
calls `Registry.invalidate_resolver_cache!`. This discards the cached resolver on every
|
|
32
|
+
Zeitwerk code reload in development, preventing stale config after an initializer change.
|
|
33
|
+
In production it fires once after eager load and is effectively a no-op.
|
|
34
|
+
- **`depends_on` missing-dependency warning** — `PackResolver` now emits a clear `[rails-ai-bridge]`
|
|
35
|
+
warning to stderr when an active pack declares `depends_on` entries that are not in the active
|
|
36
|
+
pack set. The warning names each missing dependency and tells the user which manifest field to
|
|
37
|
+
update. Packs still load; this is an advisory warning, not an abort. Transitive dependency
|
|
38
|
+
loading remains unimplemented (see `docs/gem-general-improvements.md`).
|
|
39
|
+
- **Stable local pack names** — local registry packs previously received names like `local_0`,
|
|
40
|
+
`local_1` based on array index, so reordering `local_registry_paths` silently shifted pack
|
|
41
|
+
identities. Names are now derived from a SHA256 digest of the path
|
|
42
|
+
(`local_<first 8 hex chars>`), making them stable regardless of ordering.
|
|
43
|
+
- **`docs/offline-mode.md`** — design plan for a future `offline:` config flag that prevents
|
|
44
|
+
all git operations and serves the local cache as-is; includes rake pull task design, vendored
|
|
45
|
+
snapshot pattern, and CI caching guidance.
|
|
46
|
+
- **`docs/gem-general-improvements.md`** — roadmap of eight broader improvements: manifest
|
|
47
|
+
schema validation, pack version lock file, agent-facing JSON output from rake tasks, full
|
|
48
|
+
SHA-256 cache keys, transitive `depends_on` loading, structured logging, and more.
|
|
49
|
+
|
|
50
|
+
### Changed
|
|
51
|
+
|
|
52
|
+
- **`PackResolver` errors raised as `ResolutionError`** — the two bare `raise "..."` calls in
|
|
53
|
+
`PackResolver` (unknown pack name, missing tile manifest) and the one in `load_local_registries`
|
|
54
|
+
now raise `SkillSourceResolver::ResolutionError` instead of a plain `RuntimeError`. Callers
|
|
55
|
+
that rescue `ResolutionError` from `SkillSourceResolver` will now also catch pack-level failures
|
|
56
|
+
without needing a separate `rescue RuntimeError`.
|
|
57
|
+
- **`SourceParser` rejects `http://` URLs** — plain HTTP was previously accepted as a git source.
|
|
58
|
+
It is now rejected because cloning over unencrypted HTTP exposes credentials and pack content in
|
|
59
|
+
transit. Use `https://` or `git@` (SSH) instead. The error message and module docstring are
|
|
60
|
+
updated to explain the reason and list the supported formats.
|
|
61
|
+
- **`ListRegistry` type-guard comment** — the `unless %w[skills agents packs].include?(type)`
|
|
62
|
+
guard is retained as a defence-in-depth fallback (the MCP SDK enum constraint catches invalid
|
|
63
|
+
values first) and now carries an explanatory comment to prevent future confusion.
|
|
64
|
+
- **`Registry.build_resolver_uncached`** — wires `git_timeout` and `git_pull_ttl` from
|
|
65
|
+
`Config::Registry` into `DefaultGitRunner` and `SkillSourceResolver` respectively, so
|
|
66
|
+
configuration changes take effect on the next resolver rebuild.
|
|
67
|
+
|
|
68
|
+
### Fixed
|
|
69
|
+
|
|
70
|
+
- **`validate_cache_dir` documentation clarified** — the YARD docstring now explains why the
|
|
71
|
+
lexical `Pathname#cleanpath` check (rather than `File.realpath`) is used: the cache directory
|
|
72
|
+
may not exist yet at validation time. The security guarantee is stated explicitly: cache keys
|
|
73
|
+
are SHA256-derived and not attacker-controlled, so even an unexpected symlink target is safe.
|
|
74
|
+
|
|
75
|
+
### Tests
|
|
76
|
+
|
|
77
|
+
- **`checkout_ref` — 8 new examples** covering: successful checkout returns the cache path;
|
|
78
|
+
git checkout called with the correct ref; non-zero exit raises `ResolutionError`; error message
|
|
79
|
+
includes ref name, source pack name, and stderr text; timeout raises `ResolutionError` with
|
|
80
|
+
`"timed out"` and ref name in message; nil ref skips `git checkout` entirely.
|
|
81
|
+
- **Pull freshness — 3 new examples**: TTL=0 always pulls on every resolve; large TTL skips
|
|
82
|
+
the second pull within the window; second resolve after TTL expiry re-pulls (verified by
|
|
83
|
+
backdating `@last_pulled` via instance variable access).
|
|
84
|
+
- **`DefaultGitRunner` timeout — 4 new examples**: `#timeout` defaults to 30; configurable
|
|
85
|
+
via constructor; clone timeout raises `RuntimeError` with duration; pull timeout same.
|
|
86
|
+
- **`ResolverCache` TTL spec** — replaced `sleep(0.01)` (wall-clock dependency) with an
|
|
87
|
+
injectable `monotonic_clock:` lambda that returns `0` on the first call and `99_999` thereafter,
|
|
88
|
+
making the TTL-expiry test deterministic and instant.
|
|
89
|
+
- **Total: 2043 examples, 0 failures, 94.67% line coverage** (up from 94.53%)
|
|
90
|
+
|
|
91
|
+
- **Registry data structures (PR 1)** — new `RailsAiBridge::Registry` module with immutable value objects
|
|
92
|
+
porting the Rust `agent-mcp-runtime` registry types to Ruby:
|
|
93
|
+
- `Registry::RegistryManifest` — root manifest (version, packs, default\_stack); `from_json` / `from_file`
|
|
94
|
+
- `Registry::PackDefinition` — single pack descriptor (source, tile, always\_loaded, depends\_on)
|
|
95
|
+
- `Registry::TileManifest` — pack skill/agent catalog; `from_json` / `from_file`
|
|
96
|
+
- `Registry::SkillEntry`, `Registry::AgentEntry` — metadata entries for skills and agents
|
|
97
|
+
- `Registry::DeprecatedEntry` — deprecation redirect (moved\_to, message, removed\_in)
|
|
98
|
+
- `Registry::FrontmatterParser` — internal YAML frontmatter extractor for skill markdown files;
|
|
99
|
+
used when a `SkillEntry` carries no description in `tile.json`
|
|
100
|
+
- **Git source resolver + pack detector (PR 2)** — git repository caching and framework auto-detection:
|
|
101
|
+
- `Registry::GitRunner` — module interface for git operations (injectable for tests)
|
|
102
|
+
- `Registry::DefaultGitRunner` — Open3-based implementation using stdlib git commands
|
|
103
|
+
- `Registry::SkillSourceResolver` — resolves remote git sources to local cache directories;
|
|
104
|
+
clones if missing, pulls if cached; cache dir defaults to `~/.rails-ai-bridge/cache/`
|
|
105
|
+
(env override: `RAILS_AI_BRIDGE_CACHE_DIR`); cache key uses sanitized source + SHA256 hash
|
|
106
|
+
- `Registry::DetectedFramework` — enum-like value object (Rails, Hanami)
|
|
107
|
+
- `Registry::PackDetector` — detects Rails/Hanami frameworks from Gemfile content;
|
|
108
|
+
supports single/double quotes, version constraints, ignores commented lines
|
|
109
|
+
- **Pack resolver + registry resolver (PR 3)** — priority-based pack loading and skill/agent resolution:
|
|
110
|
+
- `Registry::PackResolver` — service object that resolves and loads skill packs from the registry manifest;
|
|
111
|
+
handles always\_loaded packs, explicit pack selection, framework auto-detection, and local registry overrides;
|
|
112
|
+
returns a `Registry::Resolver` with all packs loaded and prioritized
|
|
113
|
+
- `Registry::Resolver` — core resolver that aggregates active packs and resolves queries;
|
|
114
|
+
provides priority-based resolution of skills and agents, handles deprecation redirects,
|
|
115
|
+
validates dependencies, and guards against path traversal attacks
|
|
116
|
+
- `Registry::LoadedPack` — value object representing a loaded pack (name, tile, base\_path, priority)
|
|
117
|
+
- `Registry::ResolvedSkill` — value object representing a resolved skill/agent (name, pack, path, content)
|
|
118
|
+
- `Registry::SkillSummary` — value object for skill/agent catalogs (name, pack, description)
|
|
119
|
+
- Priority assignment: local=0, rails/hanami=10, core=20, other=30 (lower is higher priority)
|
|
120
|
+
- Path traversal guard using canonical path comparison to prevent directory escape attacks
|
|
121
|
+
- Dependency validation with warnings for unsatisfied pack dependencies
|
|
122
|
+
- **Registry configuration (PR 4)** — configuration object for registry resolution:
|
|
123
|
+
- `Config::Registry` — configuration sub-object for registry resolution settings
|
|
124
|
+
- `registry.registry_manifest_path` — path to registry manifest JSON (default: `config/rails_ai_bridge_registry.json`)
|
|
125
|
+
- `registry.skill_cache_dir` — directory for caching git repositories (default: `~/.rails-ai-bridge/cache`)
|
|
126
|
+
- `registry.skill_packs` — explicit pack names to load, or `nil` for auto-detection based on framework
|
|
127
|
+
- `registry.local_registry_paths` — local registry directory paths for skill pack overrides
|
|
128
|
+
- Registry module required in main `rails_ai_bridge.rb` for configuration availability
|
|
129
|
+
- **Registry tools, cache, source formats, and docs (PR 5 → PR 6)** — user-visible entry points
|
|
130
|
+
plus three production-quality refinements:
|
|
131
|
+
- `Tools::ListRegistry` (`rails_list_registry`) — single MCP tool replacing the previous
|
|
132
|
+
`rails_list_skills`, `rails_list_agents`, and `rails_list_packs`; required `type:` param
|
|
133
|
+
(`"skills"` | `"agents"` | `"packs"`); optional `pack:` filter for skills/agents;
|
|
134
|
+
inner `RegistryCatalogFormatter` class owns all markdown rendering (SRP)
|
|
135
|
+
- `Registry::ResolverCache` — thread-safe in-memory cache for the wired `Resolver`;
|
|
136
|
+
configurable TTL via `config.registry.resolver_ttl` (default 1800 s = 30 min);
|
|
137
|
+
nil results never cached so manifest-missing setup retries on next call;
|
|
138
|
+
`Registry.invalidate_resolver_cache!` for explicit invalidation
|
|
139
|
+
- `Config::Registry#resolver_ttl` — new accessor with 1800 s default
|
|
140
|
+
- `Registry::SourceParser` — new single-responsibility parser that classifies source strings
|
|
141
|
+
into `:local_path`, `:git_url`, or `:github_shorthand` and resolves canonical URLs;
|
|
142
|
+
raises `ResolutionError` naming all three valid formats for invalid inputs;
|
|
143
|
+
`SkillSourceResolver#resolve` now delegates to `SourceParser` and returns local paths
|
|
144
|
+
directly without git operations
|
|
145
|
+
- `PackDefinition#ref` — new optional field for git version pinning (branch, tag, or SHA);
|
|
146
|
+
`SkillSourceResolver` runs `git checkout ref` after clone/pull when set
|
|
147
|
+
- `PackResolver` — default pack catalog filename changed from `tile.json` to `directory.json`;
|
|
148
|
+
priority matching is now case-insensitive
|
|
149
|
+
- `Registry::RakePresenter` — extracted from inline rake task logic; owns all CLI formatting
|
|
150
|
+
for skill tables and resolve output
|
|
151
|
+
- `rails ai:skills:list` — delegates to `RakePresenter`
|
|
152
|
+
- `rails "ai:skills:resolve[pack,skill_name]"` — delegates to `RakePresenter`
|
|
153
|
+
- `rails ai:skills:clear_cache` — new rake task; removes cached pack repositories and
|
|
154
|
+
invalidates the in-memory resolver cache
|
|
155
|
+
- `docs/skill-registry-guide.md` — new user guide covering concepts, quick start, source
|
|
156
|
+
formats, priority rules, version pinning, `directory.json` format, MCP tool reference,
|
|
157
|
+
rake task reference, resolver cache, troubleshooting, and security model
|
|
158
|
+
- `docs/registry-resolution.md` — updated to "Registry Resolution Reference"; all
|
|
159
|
+
`tile.json` references updated to `directory.json`; new source formats table; new
|
|
160
|
+
`ref` field; `resolver_ttl` config option; cache management section; security section
|
|
161
|
+
updated for `SourceParser`
|
|
162
|
+
|
|
8
163
|
## [3.4.0] - 2026-05-21
|
|
9
164
|
|
|
10
165
|
### Added
|
data/CLAUDE.md
CHANGED
|
@@ -12,10 +12,10 @@ structure to AI assistants via the Model Context Protocol (MCP).
|
|
|
12
12
|
runs **9**, `:full` runs **26** (see `Configuration::PRESETS`). Registry:
|
|
13
13
|
`Introspector::BUILTIN_INTROSPECTORS` (includes opt-in symbols such as
|
|
14
14
|
`database_stats`, `non_ar_models` not listed in those presets).
|
|
15
|
-
- `lib/rails_ai_bridge/tools/` —
|
|
15
|
+
- `lib/rails_ai_bridge/tools/` — 14 built-in MCP tools using the official mcp SDK
|
|
16
16
|
(hosts can add more via `additional_tools`)
|
|
17
17
|
- `lib/rails_ai_bridge/serializers/` — Output formatters (claude, claude_rules,
|
|
18
|
-
cursor_rules,
|
|
18
|
+
cursor_rules, devin, devin_rules, copilot, copilot_instructions, rules,
|
|
19
19
|
markdown, JSON)
|
|
20
20
|
- `lib/rails_ai_bridge/resources.rb` — MCP resources (static data AI clients read directly)
|
|
21
21
|
- `lib/rails_ai_bridge/server.rb` — MCP server configuration (stdio + HTTP transports)
|
|
@@ -39,7 +39,7 @@ structure to AI assistants via the Model Context Protocol (MCP).
|
|
|
39
39
|
9. **Introspector presets** — `:standard` (9 core) default, `:full` (26 introspectors; optional extras such as `database_stats`, `non_ar_models`) for power users
|
|
40
40
|
10. **MCP auto-discovery** — `.mcp.json` generated by install generator
|
|
41
41
|
11. **Compact by default** — context files ≤150 lines, MCP tools use `detail` parameter (summary/standard/full)
|
|
42
|
-
12. **Per-tool split rules** — `.claude/rules/`, `.cursor/rules/`, `.
|
|
42
|
+
12. **Per-tool split rules** — `.claude/rules/`, `.cursor/rules/`, `.devin/rules/`, `.github/instructions/`
|
|
43
43
|
|
|
44
44
|
## Testing
|
|
45
45
|
|
data/README.md
CHANGED
|
@@ -21,7 +21,7 @@ rails-ai-bridge turns a Rails app into an AI-readable project map:
|
|
|
21
21
|
|
|
22
22
|
- **Static context files** give assistants an immediate overview of your app, conventions, schema shape, routes, and important models.
|
|
23
23
|
- **A read-only MCP server** lets assistants ask for exact details only when needed, such as one model, one table, one controller, or one route group.
|
|
24
|
-
- **Assistant-specific output** keeps Claude Code, Cursor, Codex, Copilot,
|
|
24
|
+
- **Assistant-specific output** keeps Claude Code, Cursor, Codex, Copilot, Devin, Gemini, and JSON consumers aligned without making you hand-write context files.
|
|
25
25
|
|
|
26
26
|
The goal is simple: help AI assistants produce code that fits your Rails app instead of generic Rails code.
|
|
27
27
|
|
|
@@ -33,9 +33,12 @@ Use the README as the shortest path to understanding and setup. Jump to deeper d
|
|
|
33
33
|
|---|---|
|
|
34
34
|
| Understand the idea in 3 minutes | [How it works](#how-it-works) |
|
|
35
35
|
| Install and generate files | [Quick start](#quick-start) |
|
|
36
|
+
| Connect Claude Code or Cursor | [Connect your AI client — Claude Code](#claude-code) |
|
|
37
|
+
| Connect Devin | [Connect your AI client — Devin](#devin) and [docs/devin-setup.md](docs/devin-setup.md) |
|
|
38
|
+
| Connect Copilot / Codex / Gemini | [Connect your AI client](#connect-your-ai-client) |
|
|
36
39
|
| Check what the AI learns | [What Your AI Learns](#what-your-ai-learns) |
|
|
37
40
|
| Choose `:standard`, `:full`, or opt-ins | [Pick the right preset for your app](#pick-the-right-preset-for-your-app) |
|
|
38
|
-
| Use MCP safely | [
|
|
41
|
+
| Use MCP safely | [HTTP transport](#http-transport-alternative-for-all-clients) and [mcp-security.md](docs/mcp-security.md) |
|
|
39
42
|
| Improve day-to-day AI results | [Best Practices](docs/BEST_PRACTICES.md) |
|
|
40
43
|
|
|
41
44
|
## When this helps
|
|
@@ -123,7 +126,7 @@ The generator prompts you to pick a profile (or pass `--profile` to skip the pro
|
|
|
123
126
|
| Profile | What it generates | Split rule dirs |
|
|
124
127
|
|---------|-------------------|-----------------|
|
|
125
128
|
| `custom` *(default)* | Per-format prompts — pick exactly what you need | Yes |
|
|
126
|
-
| `minimal` | Claude, Cursor,
|
|
129
|
+
| `minimal` | Claude, Cursor, Devin, Copilot, Gemini shims | No |
|
|
127
130
|
| `full` | Every format | Yes |
|
|
128
131
|
| `mcp` | Only `.mcp.json` — generate files later with `rails ai:bridge` | — |
|
|
129
132
|
|
|
@@ -155,7 +158,7 @@ Optional: `gem install rails-ai-bridge` installs the gem into your Ruby environm
|
|
|
155
158
|
| Zero config | Yes — Railtie + install generator | No — per-project `projects.yml` | No |
|
|
156
159
|
| Token optimization | Yes — compact files + `detail:"summary"` workflow | Varies | No |
|
|
157
160
|
| Codex-oriented repo files | Yes — `AGENTS.md`, `.codex/README.md` | No | DIY |
|
|
158
|
-
| Live MCP tools | Yes —
|
|
161
|
+
| Live MCP tools | Yes — 13 read-only `rails_*` tools (extensible) | Yes | No |
|
|
159
162
|
| Auto-introspection | Yes — up to **27** domains (`:full`) | No — server points at projects you configure | DIY |
|
|
160
163
|
|
|
161
164
|
*Comparison reflects typical documented setups; verify against each project before treating any row as absolute.*
|
|
@@ -191,9 +194,9 @@ your-rails-app/
|
|
|
191
194
|
│ ├── rails-controllers.mdc globs: app/controllers/**
|
|
192
195
|
│ └── rails-mcp-tools.mdc alwaysApply: true
|
|
193
196
|
│
|
|
194
|
-
├── 🔵
|
|
195
|
-
│ ├── .
|
|
196
|
-
│ └── .
|
|
197
|
+
├── 🔵 Devin
|
|
198
|
+
│ ├── .devinrules ≤5,800 chars (6K limit)
|
|
199
|
+
│ └── .devin/rules/
|
|
197
200
|
│ ├── rails-context.md project overview
|
|
198
201
|
│ └── rails-mcp-tools.md tool reference
|
|
199
202
|
│
|
|
@@ -247,7 +250,7 @@ This keeps context focused and avoids unnecessary token usage while still allowi
|
|
|
247
250
|
|
|
248
251
|
## MCP Tools
|
|
249
252
|
|
|
250
|
-
The gem exposes **
|
|
253
|
+
The gem exposes **13 built-in tools** via MCP that AI clients call on-demand (hosts can append more via `config.additional_tools`):
|
|
251
254
|
|
|
252
255
|
| Tool | What it returns |
|
|
253
256
|
|------|----------------|
|
|
@@ -263,6 +266,7 @@ The gem exposes **12 built-in tools** via MCP that AI clients call on-demand (ho
|
|
|
263
266
|
| `rails_get_view` | View layouts, templates, partials; optional per-file detail under the configured `app/views` path |
|
|
264
267
|
| `rails_search_semantic` | Semantic code search using rubydex — find declarations by name with types, locations, and relationships |
|
|
265
268
|
| `rails_get_stimulus` | Stimulus controllers: targets, values, actions, outlets (requires `:stimulus` introspector) |
|
|
269
|
+
| `rails_list_registry` | Skill pack catalog — list skills, agents, or active packs; requires `config/rails_ai_bridge_registry.json` |
|
|
266
270
|
|
|
267
271
|
All tools are **read-only** — they never modify your application or database.
|
|
268
272
|
|
|
@@ -303,7 +307,7 @@ This is expected: compact assistant-specific files and the summary-first MCP wor
|
|
|
303
307
|
|
|
304
308
|
Observed benefits so far:
|
|
305
309
|
- Less exploratory reading before the assistant reaches the relevant files
|
|
306
|
-
- Faster first useful response in Cursor and
|
|
310
|
+
- Faster first useful response in Cursor and Devin trials
|
|
307
311
|
- Similar or slightly better answer quality with clearer project grounding
|
|
308
312
|
- More predictable drill-down via `detail:"summary"` first, then focused lookups
|
|
309
313
|
|
|
@@ -311,68 +315,114 @@ Results will vary by client, model, project size, and task type. More formal ben
|
|
|
311
315
|
|
|
312
316
|
---
|
|
313
317
|
|
|
314
|
-
##
|
|
318
|
+
## Connect your AI client
|
|
315
319
|
|
|
316
|
-
|
|
320
|
+
rails-ai-bridge gives every client two things: **static context files** loaded at session start (snapshots of your app), and **live MCP tools** called on-demand (always current). Both matter — files orient the assistant, tools answer specific questions without bloating context.
|
|
317
321
|
|
|
318
|
-
|
|
322
|
+
| Client | Static files loaded automatically | MCP wiring |
|
|
323
|
+
|--------|----------------------------------|------------|
|
|
324
|
+
| **Claude Code** | `CLAUDE.md`, `.claude/rules/*.md` | Auto — reads `.mcp.json` |
|
|
325
|
+
| **Cursor** | `.cursorrules`, `.cursor/rules/*.mdc` | Auto — reads `.mcp.json` |
|
|
326
|
+
| **Devin** | `.devinrules`, `.devin/rules/*.md`, `AGENTS.md` | Manual — create `.devin/mcp.json` |
|
|
327
|
+
| **Copilot** | `.github/copilot-instructions.md`, `.github/instructions/` | Not supported natively |
|
|
328
|
+
| **Codex** | `AGENTS.md`, `.codex/README.md` | Via `.codex/mcp_servers.json` |
|
|
329
|
+
| **Gemini** | `GEMINI.md` | Via Gemini CLI config |
|
|
319
330
|
|
|
320
|
-
|
|
331
|
+
### Claude Code
|
|
321
332
|
|
|
322
|
-
|
|
323
|
-
<summary><strong>Claude Desktop setup</strong></summary>
|
|
333
|
+
No MCP setup needed. Claude Code auto-detects `.mcp.json` at the project root and spawns `bundle exec rails ai:serve` automatically. Ask Claude "What rails_* MCP tools do you have?" to confirm — it should list `rails_get_schema`, `rails_get_routes`, and the rest.
|
|
324
334
|
|
|
325
|
-
|
|
335
|
+
If the connection fails: verify `.mcp.json` exists and that `bundle exec rails ai:serve` runs cleanly in your terminal.
|
|
336
|
+
|
|
337
|
+
### Cursor
|
|
338
|
+
|
|
339
|
+
No MCP setup needed. Cursor auto-detects `.mcp.json`. If it does not pick it up, open **Settings > MCP** and add the server manually with `BUNDLE_GEMFILE: "${workspaceFolder}/Gemfile"` in the `env` block.
|
|
340
|
+
|
|
341
|
+
**Ruby version manager issue (rbenv/rvm):** Cursor may not inherit your shell environment when launching sub-processes. Fix: enable the HTTP transport instead.
|
|
342
|
+
|
|
343
|
+
```ruby
|
|
344
|
+
# config/initializers/rails_ai_bridge.rb
|
|
345
|
+
RailsAiBridge.configure do |config|
|
|
346
|
+
config.auto_mount = true
|
|
347
|
+
config.http_path = "/mcp"
|
|
348
|
+
config.http_bind = "127.0.0.1"
|
|
349
|
+
end
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
Start your Rails server and point Cursor to `http://localhost:3000/mcp` (type: SSE) in Settings > MCP.
|
|
353
|
+
|
|
354
|
+
### Devin
|
|
326
355
|
|
|
356
|
+
Devin reads `.devinrules`, `.devin/rules/*.md`, and `AGENTS.md` automatically. MCP requires one manual step.
|
|
357
|
+
|
|
358
|
+
**Step 1 — generate files:**
|
|
359
|
+
```bash
|
|
360
|
+
rails ai:bridge # all formats, including .devinrules and AGENTS.md
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
**Step 2 — create `.devin/mcp.json`:**
|
|
327
364
|
```json
|
|
328
365
|
{
|
|
329
366
|
"mcpServers": {
|
|
330
367
|
"rails-ai-bridge": {
|
|
331
368
|
"command": "bundle",
|
|
332
369
|
"args": ["exec", "rails", "ai:serve"],
|
|
333
|
-
"cwd": "/path/to/your/rails/app"
|
|
370
|
+
"cwd": "/absolute/path/to/your/rails/app"
|
|
334
371
|
}
|
|
335
372
|
}
|
|
336
373
|
}
|
|
337
374
|
```
|
|
338
|
-
</details>
|
|
339
375
|
|
|
340
|
-
|
|
341
|
-
|
|
376
|
+
Use the absolute path in `cwd` — Devin does not inherit your terminal's working directory. Commit this file so your team gets the same setup.
|
|
377
|
+
|
|
378
|
+
**Step 3 — verify:** In a Devin session ask "What MCP tools do you have available?" — it should list the `rails-ai-bridge` server and all `rails_*` tools.
|
|
379
|
+
|
|
380
|
+
**Ruby version manager issue:** If `bundle` is not on `PATH`, use the absolute shim path (e.g. `/Users/you/.rbenv/shims/bundle`) or switch to the HTTP transport. See [docs/devin-setup.md](docs/devin-setup.md) for the full guide including HTTP transport, skills, and troubleshooting.
|
|
381
|
+
|
|
382
|
+
### GitHub Copilot
|
|
383
|
+
|
|
384
|
+
MCP is not natively supported in the Copilot VS Code extension. The static files (`CLAUDE.md`, `.github/copilot-instructions.md`, path-scoped `.github/instructions/`) give Copilot project grounding, and the MCP tools are documented in the generated files so Copilot knows what to ask — but it cannot call them automatically. For tasks that need live schema or route lookups, use Claude Code or Cursor.
|
|
385
|
+
|
|
386
|
+
### Codex
|
|
387
|
+
|
|
388
|
+
Codex reads `AGENTS.md` at the repository root. MCP can be configured in `.codex/mcp_servers.json`. Run `rails ai:bridge:codex` to regenerate `AGENTS.md` and `.codex/README.md` (which includes Codex-specific setup notes).
|
|
389
|
+
|
|
390
|
+
### HTTP transport (alternative for all clients)
|
|
391
|
+
|
|
392
|
+
If stdio MCP fails (usually a Ruby version manager PATH issue), start the HTTP server instead:
|
|
342
393
|
|
|
343
394
|
```bash
|
|
344
|
-
rails ai:serve_http
|
|
395
|
+
rails ai:serve_http # http://127.0.0.1:6029/mcp
|
|
345
396
|
```
|
|
346
397
|
|
|
347
|
-
Or auto-mount inside your Rails app:
|
|
398
|
+
Or auto-mount inside your running Rails app:
|
|
348
399
|
|
|
349
400
|
```ruby
|
|
350
401
|
RailsAiBridge.configure do |config|
|
|
351
402
|
config.auto_mount = true
|
|
352
|
-
config.http_mcp_token =
|
|
353
|
-
# Production only: explicit opt-in + token required (see SECURITY.md)
|
|
354
|
-
# config.allow_auto_mount_in_production = true
|
|
403
|
+
config.http_mcp_token = ENV["RAILS_AI_BRIDGE_MCP_TOKEN"] # required in production
|
|
355
404
|
config.http_path = "/mcp"
|
|
356
|
-
|
|
357
|
-
# config.mcp.require_http_auth = true
|
|
405
|
+
config.http_bind = "127.0.0.1"
|
|
358
406
|
end
|
|
359
407
|
```
|
|
360
408
|
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
Security note: keep the HTTP transport bound to `127.0.0.1` unless you add your own network and authentication controls. The tools are read-only, but they can still expose sensitive application structure. Generated context and the built-in conventions resource filter secret-bearing config paths, but MCP access should still be treated as internal. In **production**, `rails ai:serve_http` and `auto_mount` require a configured MCP token; `auto_mount` also requires `allow_auto_mount_in_production = true`. For operational hardening (tokens, proxies, `require_http_auth`, stdio threat model), see **[docs/mcp-security.md](docs/mcp-security.md)** and **[SECURITY.md](SECURITY.md)**.
|
|
364
|
-
</details>
|
|
365
|
-
|
|
366
|
-
---
|
|
409
|
+
Point your AI client to `http://localhost:3000/mcp` (or whichever port your Rails server uses) using transport type `SSE`. Keep the endpoint bound to localhost unless you add authentication. See [docs/mcp-security.md](docs/mcp-security.md) for production hardening.
|
|
367
410
|
|
|
368
|
-
|
|
411
|
+
### Claude Desktop (standalone app)
|
|
369
412
|
|
|
370
|
-
|
|
413
|
+
Add to `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS):
|
|
371
414
|
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
-
|
|
415
|
+
```json
|
|
416
|
+
{
|
|
417
|
+
"mcpServers": {
|
|
418
|
+
"rails-ai-bridge": {
|
|
419
|
+
"command": "bundle",
|
|
420
|
+
"args": ["exec", "rails", "ai:serve"],
|
|
421
|
+
"env": { "BUNDLE_GEMFILE": "/absolute/path/to/your/rails/app/Gemfile" }
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
```
|
|
376
426
|
|
|
377
427
|
---
|
|
378
428
|
|
|
@@ -488,6 +538,13 @@ end
|
|
|
488
538
|
| `parallel_introspection` | `false` | Run introspectors concurrently (requires `concurrent-ruby`, which is already a Rails dependency) |
|
|
489
539
|
| `parallel_pool_size` | `4` | Max threads in the parallel pool; capped at the number of active introspectors so no idle threads are created |
|
|
490
540
|
| `parallel_timeout_seconds` | `10` | Per-introspector future timeout (seconds); timed-out introspectors return `{ error: "timed out after Ns" }` without blocking the others |
|
|
541
|
+
| `registry.registry_manifest_path` | `"config/rails_ai_bridge_registry.json"` | Path to the registry manifest JSON file for skill pack resolution |
|
|
542
|
+
| `registry.skill_cache_dir` | `"~/.rails-ai-bridge/cache"` | Directory for caching git repositories containing skill packs |
|
|
543
|
+
| `registry.skill_packs` | `nil` | Explicit pack names to load, or `nil` for auto-detection based on framework |
|
|
544
|
+
| `registry.local_registry_paths` | `[]` | Local directory paths (must contain `directory.json`) loaded at priority 0 |
|
|
545
|
+
| `registry.resolver_ttl` | `1800` | Seconds to cache the wired resolver in memory; `0` disables caching |
|
|
546
|
+
| `registry.git_pull_ttl` | `86400` | Seconds between `git pull` refreshes per cached pack (24 h default). Set to `0` to pull on every resolver rebuild |
|
|
547
|
+
| `registry.git_timeout` | `30` | Seconds before a git operation (clone, pull, checkout) is forcibly interrupted |
|
|
491
548
|
|
|
492
549
|
Other HTTP MCP knobs live only on the nested object, for example `RailsAiBridge.configuration.mcp.authorize`, `mcp.mode`, `mcp.security_profile`, and `mcp.require_auth_in_production` — see [docs/GUIDE.md](docs/GUIDE.md) and [docs/mcp-security.md](docs/mcp-security.md).
|
|
493
550
|
</details>
|
|
@@ -569,6 +626,35 @@ To customize it in your initializer (`config/initializers/rails_ai_bridge.rb`):
|
|
|
569
626
|
|
|
570
627
|
---
|
|
571
628
|
|
|
629
|
+
### Skill Packs
|
|
630
|
+
|
|
631
|
+
rails-ai-bridge can load **skill packs** — shared collections of agent instructions — from versioned git repositories and surface them through `rails_list_registry` and rake tasks.
|
|
632
|
+
|
|
633
|
+
```ruby
|
|
634
|
+
config.registry.registry_manifest_path = "config/rails_ai_bridge_registry.json"
|
|
635
|
+
```
|
|
636
|
+
|
|
637
|
+
Quick example manifest (`config/rails_ai_bridge_registry.json`):
|
|
638
|
+
|
|
639
|
+
```json
|
|
640
|
+
{
|
|
641
|
+
"version": "1.0.0",
|
|
642
|
+
"packs": {
|
|
643
|
+
"rails": { "source": "igmarin/rails-agent-skills" },
|
|
644
|
+
"core": { "source": "igmarin/ruby-core-skills", "always_loaded": true }
|
|
645
|
+
},
|
|
646
|
+
"default_stack": ["core"]
|
|
647
|
+
}
|
|
648
|
+
```
|
|
649
|
+
|
|
650
|
+
Pack sources accept local paths, HTTPS URLs (`https://`), SSH URLs (`git@`), or `owner/repo` GitHub shorthands. Plain `http://` URLs are rejected. Packs can be pinned to a specific version with `"ref": "v1.2.0"`.
|
|
651
|
+
|
|
652
|
+
To prevent network timeouts from blocking your server, set `config.registry.git_timeout` (default: 30 s). To control how often cached packs are refreshed, set `config.registry.git_pull_ttl` (default: 24 h; `0` to always pull).
|
|
653
|
+
|
|
654
|
+
See [docs/skill-registry-guide.md](docs/skill-registry-guide.md) for the full setup guide.
|
|
655
|
+
|
|
656
|
+
---
|
|
657
|
+
|
|
572
658
|
## Stack Compatibility
|
|
573
659
|
|
|
574
660
|
Works with every Rails architecture — auto-detects what's relevant:
|
|
@@ -594,7 +680,7 @@ Frontend introspectors (views, Turbo, Stimulus, assets) degrade gracefully — t
|
|
|
594
680
|
| `rails ai:bridge:claude` | Generate Claude Code files only |
|
|
595
681
|
| `rails ai:bridge:codex` | Generate Codex files only (`AGENTS.md` + `.codex/README.md`) |
|
|
596
682
|
| `rails ai:bridge:cursor` | Generate Cursor files only |
|
|
597
|
-
| `rails ai:bridge:
|
|
683
|
+
| `rails ai:bridge:devin` | Generate Devin files only |
|
|
598
684
|
| `rails ai:bridge:copilot` | Generate Copilot files only |
|
|
599
685
|
| `rails ai:bridge:gemini` | Generate Gemini files only |
|
|
600
686
|
| `rails ai:serve` | Start MCP server (stdio) |
|
|
@@ -602,6 +688,9 @@ Frontend introspectors (views, Turbo, Stimulus, assets) degrade gracefully — t
|
|
|
602
688
|
| `rails ai:doctor` | Run diagnostics and AI readiness score (0-100) |
|
|
603
689
|
| `rails ai:watch` | Auto-regenerate bridge files on code changes |
|
|
604
690
|
| `rails ai:inspect` | Print introspection summary to stdout |
|
|
691
|
+
| `rails ai:skills:list` | Print skill catalog from loaded skill packs |
|
|
692
|
+
| `rails "ai:skills:resolve[pack,name]"` | Resolve and print a skill's full content |
|
|
693
|
+
| `rails ai:skills:clear_cache` | Remove locally cached pack repositories |
|
|
605
694
|
|
|
606
695
|
> **Bridge modes:**
|
|
607
696
|
> ```bash
|
|
@@ -655,7 +744,12 @@ The docs are layered so new users do not need to read everything at once.
|
|
|
655
744
|
| A quick install and mental model | This README |
|
|
656
745
|
| How to get better AI output day to day | [docs/BEST_PRACTICES.md](docs/BEST_PRACTICES.md) |
|
|
657
746
|
| Every command, config option, generated file, and MCP parameter | [docs/GUIDE.md](docs/GUIDE.md) |
|
|
747
|
+
| Complete Devin setup — MCP wiring, skills, troubleshooting | [docs/devin-setup.md](docs/devin-setup.md) |
|
|
658
748
|
| HTTP MCP hardening and production safety | [docs/mcp-security.md](docs/mcp-security.md) and [SECURITY.md](SECURITY.md) |
|
|
749
|
+
| Skill packs: setup, sources, pinning, cache, troubleshooting | [docs/skill-registry-guide.md](docs/skill-registry-guide.md) |
|
|
750
|
+
| Skill registry technical reference | [docs/registry-resolution.md](docs/registry-resolution.md) |
|
|
751
|
+
| Offline mode design plan | [docs/offline-mode.md](docs/offline-mode.md) |
|
|
752
|
+
| Gem improvement roadmap | [docs/gem-general-improvements.md](docs/gem-general-improvements.md) |
|
|
659
753
|
| Upgrade notes between major versions | [UPGRADING.md](UPGRADING.md) |
|
|
660
754
|
| Release history | [CHANGELOG.md](CHANGELOG.md) |
|
|
661
755
|
| Development and contribution workflow | [CONTRIBUTING.md](CONTRIBUTING.md) |
|
data/docs/BEST_PRACTICES.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
> For installation and a quick overview, see the [README](../README.md).
|
|
4
4
|
> For the full command and configuration reference, see the [Guide](GUIDE.md).
|
|
5
5
|
|
|
6
|
-
This document consolidates the patterns that consistently produce the best results when using rails-ai-bridge across Cursor,
|
|
6
|
+
This document consolidates the patterns that consistently produce the best results when using rails-ai-bridge across Cursor, Devin, Copilot, Codex, and Claude Code — informed by real-world usage and feedback from multiple AI assistants evaluating the gem.
|
|
7
7
|
|
|
8
8
|
---
|
|
9
9
|
|
|
@@ -51,17 +51,17 @@ Each AI client reads different files. Knowing which files matter for your tool h
|
|
|
51
51
|
|--------|---------------------------------|----------|-------|
|
|
52
52
|
| **Claude Code** | `CLAUDE.md`, `.claude/rules/*.md` | `.mcp.json` auto-detected | Rules injected per-session; MCP auto-wired via `.mcp.json` |
|
|
53
53
|
| **Cursor** | `.cursorrules`, `.cursor/rules/*.mdc` | `.mcp.json` auto-detected | `alwaysApply: true` rules loaded every turn; glob-scoped rules loaded per file |
|
|
54
|
-
| **
|
|
54
|
+
| **Devin** | `.devinrules`, `.devin/rules/*.md` | Manual MCP config required | 6K char limit on `.devinrules`; rules directory for overflow |
|
|
55
55
|
| **GitHub Copilot (VS Code)** | `.github/copilot-instructions.md`, `.github/instructions/*.instructions.md` | Not supported natively | `applyTo` glob patterns control which instructions file is injected |
|
|
56
56
|
| **OpenAI Codex** | `AGENTS.md`, `.codex/README.md` | `.mcp.json` (when configured) | `AGENTS.md` at repo root is the primary context source |
|
|
57
57
|
| **Gemini (AI Studio / Code Assist)** | `GEMINI.md` | MCP via Gemini CLI | `GEMINI.md` provides the project briefing; MCP for live data |
|
|
58
58
|
|
|
59
59
|
### How MCP wiring works per client
|
|
60
60
|
|
|
61
|
-
- **Claude Code & Cursor**: `.mcp.json` at the project root is auto-detected.
|
|
62
|
-
- **
|
|
61
|
+
- **Claude Code & Cursor**: `.mcp.json` at the project root is auto-detected. No manual setup — the client spawns `rails ai:serve` automatically.
|
|
62
|
+
- **Devin**: MCP is not auto-detected. Create `.devin/mcp.json` manually (see [docs/devin-setup.md](devin-setup.md) for the exact JSON and full walkthrough).
|
|
63
63
|
- **Codex**: Configure in `.codex/mcp_servers.json` or equivalent. The generated `.codex/README.md` includes setup instructions.
|
|
64
|
-
- **Copilot**: MCP is not natively supported via `.mcp.json
|
|
64
|
+
- **Copilot**: MCP is not natively supported via `.mcp.json`. The `rails_*` tools are documented in `.github/instructions/rails-mcp-tools.instructions.md` so Copilot knows about them, but cannot call them automatically.
|
|
65
65
|
|
|
66
66
|
### What "always loaded" means for token budgets
|
|
67
67
|
|
|
@@ -73,7 +73,7 @@ Files marked as `alwaysApply: true` (Cursor) or loaded at session start are incl
|
|
|
73
73
|
|
|
74
74
|
### Built-in tools and HTTP MCP
|
|
75
75
|
|
|
76
|
-
There are **
|
|
76
|
+
There are **14** read-only built-in `rails_*` tools (hosts can add more via configuration). For Hotwire-heavy work, include `:views` and `:stimulus` in your introspectors so `rails_get_view` and `rails_get_stimulus` return live data. If MCP is served over HTTP beyond a locked-down localhost setup, configure authentication and read [mcp-security.md](mcp-security.md) and the repository [SECURITY.md](../SECURITY.md).
|
|
77
77
|
|
|
78
78
|
---
|
|
79
79
|
|
|
@@ -198,7 +198,7 @@ If `overrides.md` still has the omit-merge guard after initial setup, the gem in
|
|
|
198
198
|
| Team-wide conventions (all clients) | `config/rails_ai_bridge/overrides.md` |
|
|
199
199
|
| Claude Code-specific guidance | Append to `CLAUDE.md` after regeneration |
|
|
200
200
|
| Cursor-specific rules | Add a `.cursor/rules/my-rules.mdc` that won't be overwritten |
|
|
201
|
-
|
|
|
201
|
+
| Devin-specific | Add a `.devin/rules/my-rules.md` that won't be overwritten |
|
|
202
202
|
|
|
203
203
|
The gem only overwrites files it generated. Files you create with different names are safe.
|
|
204
204
|
|
|
@@ -221,11 +221,13 @@ The gem only overwrites files it generated. Files you create with different name
|
|
|
221
221
|
4. `.cursorrules` is generated for legacy compatibility only. Cursor 0.45+ uses `.cursor/rules/` exclusively. Both can coexist safely.
|
|
222
222
|
5. MCP is auto-wired via `.mcp.json`. Run `rails ai:serve` once; Cursor keeps it alive.
|
|
223
223
|
|
|
224
|
-
###
|
|
224
|
+
### Devin
|
|
225
225
|
|
|
226
|
-
1. `.
|
|
227
|
-
2.
|
|
228
|
-
3.
|
|
226
|
+
1. `.devinrules` is capped at ~5,800 characters (Devin's 6K limit). The gem respects this — overflow goes into `.devin/rules/`.
|
|
227
|
+
2. Devin also reads `AGENTS.md` — run `rails ai:bridge` (not just `rails ai:bridge:devin`) to keep both files current.
|
|
228
|
+
3. MCP requires a manual one-time step: create `.devin/mcp.json` with an absolute `cwd` path. See [docs/devin-setup.md](devin-setup.md) for the exact JSON.
|
|
229
|
+
4. If `bundle` is not on `PATH` (common with rbenv/rvm in Devin's environment), use the absolute shim path or switch to the HTTP transport (`rails ai:serve_http`).
|
|
230
|
+
5. Devin follows the "summary first, drill down" pattern well — the generated `.devin/rules/rails-mcp-tools.md` teaches it this workflow automatically.
|
|
229
231
|
|
|
230
232
|
### GitHub Copilot
|
|
231
233
|
|
|
@@ -336,8 +338,8 @@ AGENTS.md
|
|
|
336
338
|
GEMINI.md
|
|
337
339
|
.cursorrules
|
|
338
340
|
.cursor/rules/
|
|
339
|
-
.
|
|
340
|
-
.
|
|
341
|
+
.devinrules
|
|
342
|
+
.devin/rules/
|
|
341
343
|
.github/copilot-instructions.md
|
|
342
344
|
.github/instructions/
|
|
343
345
|
.codex/README.md
|