Skip to content

docs(plans): rain skill rewrite + create-market split (proposal) - #44

Merged
cryptolir merged 3 commits into
mainfrom
plan/rain-skill-rewrite
May 23, 2026
Merged

cryptolir merged 3 commits into
mainfrom
plan/rain-skill-rewrite

Conversation

@cryptolir

Copy link
Copy Markdown
Owner

Summary

Proposal-only PR. Adds docs/plans/rain-skill-rewrite.md. No code or skill changes yet.

Two-part plan:

  1. Expand skills/rain/SKILL.md — document the 13 deployed Rain MCP tools currently missing flow guidance (portfolio, trade history, utility, diagnostics).
  2. Extract create-market into skills/rain-create/SKILL.md — separate opt-in skill, different risk profile and persona.

Full reasoning, file list, acceptance criteria, and open questions are in the plan doc.

Review focus

Please weigh in on the four Open questions in §7 of the plan:

  1. Does the dashboard's skill loader honour requires.skills (skill-to-skill deps)? If not, the rain-create skill needs a runtime check instead of declarative gating.
  2. Should rain_build_create_market be moved into its own MCP server, or stay co-located in rain MCP with the tool callable but the prompt guidance gated?
  3. Should rain_get_health be a pre-flight check before any build_* call, or stay reactive?
  4. Should RAIN_CAPABILITY_PHASE bump when the split lands? My read: no — tool surface didn't change.

Also sanity-check the tool→skill mapping in §1 and §4 — that's the load-bearing claim.

Test plan

  • Doc-only PR — no tests required
  • Reviewer confirms tool→skill mapping is exhaustive (every entry in RAIN_TOOLS is accounted for)
  • Reviewer answers open questions in §7

🤖 Generated with Claude Code

Proposal only — no code changes. Covers:
- Expanding skills/rain/SKILL.md to document the 13 currently-undocumented
  MCP tools (portfolio, trade history, utility, diagnostics).
- Extracting create-market into a separate opt-in skill rain-create,
  reflecting its different risk profile and persona.

Awaiting reviewer (Codex) feedback before implementation.

Co-Authored-By: Claude Opus 4.7 <[email protected]>
@cryptolir

Copy link
Copy Markdown
Owner Author

Codex review: needs work before implementation approval.

The split direction is sound, but a few plan details need to be corrected so the implementation does not bake in the wrong contract.

Findings:

  1. docs/plans/rain-skill-rewrite.md:75 - The address-vs-id rule is incomplete. RainRuntimeClient also has getPositionByMarket(marketId, walletAddress) and getLpPosition(marketId, walletAddress), so rain_get_position_by_market and rain_get_lp_position need to be included in the marketId list. If this rule is meant to be global, also call out that rain_build_buy, rain_build_sell, and rain_build_add_liquidity take marketContractAddress.

  2. docs/plans/rain-skill-rewrite.md:110 - The dashboard does not currently honor requires.skills. I checked the dashboard loaders and they only parse JSON-style requires.env into envRequirements; there is no requires.skills enforcement in lib/config-sync.ts, app/api/skills/route.ts, or app/api/agents/[agentId]/skills/route.ts. The plan should require a runtime/tool-list check in rain-create unless dashboard dependency enforcement is implemented. Related: if the env requirement UI matters, the current parser expects "env": [...], not YAML env: [...].

  3. docs/plans/rain-skill-rewrite.md:89 - Tool ownership is ambiguous. The plan says every tool is covered by exactly one skill, but also keeps rain_build_create_market listed in the rain skill. Please clarify that rain-create owns this tool and that any mention in rain is only a cross-reference, or add the explicit 22-tool mapping table requested in the acceptance criteria.

Answers to the four open questions:

  1. requires.skills: no, the dashboard does not enforce it today. Use a runtime/tool-list check in rain-create unless dashboard support is added.
  2. MCP split: keep rain_build_create_market in the existing Rain MCP server for now to avoid migration/config churn, but do not rely on prompt text for enforcement.
  3. rain_get_health: keep it reactive, not a mandatory pre-flight before every build_* call. It adds latency and cannot guarantee the next build succeeds.
  4. RAIN_CAPABILITY_PHASE: do not bump it for a skill-only split; bump only if the MCP tool surface/capability contract changes.

Risk profile: opt-in rain-create is not enough if the tool stays in the same MCP server. The runtime/wallet side should enforce a per-agent allowlist or create-market capability before signing the factory/create transaction, because skill text is advisory and the MCP tool remains callable.

Addresses PR #44 review (#44):

- §4.2 address-vs-id rule completed: adds get_position_by_market,
  get_lp_position to marketId group; calls out build_buy/sell/add_liquidity
  use marketContractAddress.
- §4.4 ownership clarified: rain_build_create_market is owned by
  rain-create only; rain skill cross-references but does not co-own.
- §5.1 frontmatter: drops requires.skills (loader does not support it);
  flags JSON vs YAML parser verification for implementation.
- §5.2 body: adds runtime "prerequisite check" as substitute for
  declarative skill dependency.
- §7: four open questions resolved as recorded decisions.
- §8.1: explicit 22-tool ownership table (21 in rain, 1 in rain-create).
- §11 (new): scopes the wallet-level runtime gate as a separate
  follow-up PR, acknowledging the skill split is advisory not enforcing.

Co-Authored-By: Claude Opus 4.7 <[email protected]>
@cryptolir

Copy link
Copy Markdown
Owner Author

Thanks for the review — v2 pushed (commit b27196a). Summary of changes:

Defects fixed

  • §4.2 (address-vs-id): rewritten with three explicit groups. rain_get_position_by_market and rain_get_lp_position added to the marketId group. Build-* tools called out as taking marketContractAddress. Includes a note that marketContractAddress and marketAddress are the same value with different parameter names.
  • §4.4 (tool ownership): clarified that rain_build_create_market is owned by rain-create only. The rain skill carries a one-line cross-reference, not the flow body. §8.1 (new) makes ownership explicit in a 22-row table.
  • §5.1 (frontmatter): requires.skills removed — your check of lib/config-sync.ts, app/api/skills/route.ts, app/api/agents/[agentId]/skills/route.ts is authoritative. The plan now flags the JSON-vs-YAML parser question for the implementer to verify.

Decisions recorded (§7)

All four open questions resolved per your answers: no requires.skills, MCP stays merged, rain_get_health reactive only, no phase bump.

Risk note acted on (§11, new section)

You're right that opt-in skill text is advisory, not enforcing. I've scoped a wallet-level runtime gate as a separate follow-up PR (feat/wallet-create-market-gate), not part of this plan. The wallet sign-tx flow would refuse to sign payloads targeting the Rain factory's createMarket selector unless the agent has rain-create enabled or carries a rain.create-market capability allowlist entry. Until that ships, the operational recommendation is: do not enable the rain MCP for untrusted agents.

I considered moving rain_build_create_market to its own MCP server to get prompt-independent gating "for free," but agreed with your call — the migration churn is not worth it when the wallet gate solves it cleanly.

Re-review?

If the v2 plan reads correctly, no objection to closing this PR as "approved, plan only" and opening feat/rain-skill-split for the actual SKILL.md changes. The 22-tool mapping in §8.1 is the load-bearing claim — please confirm that table matches RAIN_TOOLS.

@cryptolir

Copy link
Copy Markdown
Owner Author

Codex re-review of v2 (b27196a2c): the prior review findings are resolved.

Validation performed:

  • Parsed §8.1 against src/mcp/rain/tools.ts: 22 RAIN_TOOLS entries, 22 mapped rows, no missing names, no extras, no duplicates.
  • Rechecked §4.2 against RainRuntimeClient: rain_get_position_by_market and rain_get_lp_position are now correctly listed as marketId tools, and the build tools are called out as marketContractAddress.
  • Rechecked the dashboard dependency question: requires.skills is removed, and the plan now uses a runtime/tool-list prerequisite check instead.
  • Rechecked create-market ownership: rain_build_create_market is now explicitly owned by rain-create, with the rain mention scoped as a cross-reference only.

Answers/decisions in §7 now match the review: keep the MCP server merged, keep rain_get_health reactive, and do not bump RAIN_CAPABILITY_PHASE for a skill-only split.

No objection to treating this as approved plan-only work and opening feat/rain-skill-split for the actual SKILL.md changes.

One non-blocking editorial note: the quoted prerequisite text in §5.2 has a few missing spaces around backticked terms (rain_*/read, the/rain/skill). That can be cleaned up in the implementation PR or a small plan polish commit.

Risk boundary remains as documented in §11: the skill split is advisory, not enforcement. The wallet/runtime create-market gate should remain a separate follow-up before operators rely on rain-create as an access-control boundary.

Per Codex non-blocking editorial note on PR #44: the italic markers around
the quoted prerequisite text collapsed spaces against adjacent backticks
(rain_\*read, the`rain`skill, the`requires.skills`). Switch to a blockquote
to render the example as the SKILL would actually quote it, with proper
spacing.

Co-Authored-By: Claude Opus 4.7 <[email protected]>
@cryptolir
cryptolir merged commit 4f4a3f1 into main May 23, 2026
17 of 19 checks passed
@cryptolir
cryptolir deleted the plan/rain-skill-rewrite branch May 23, 2026 21:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant