Skip to content

feat(cli-skills): strengthen self-learning guidance in wren-usage skill#1514

Merged
goldmedal merged 4 commits intoCanner:feat/cli-0.2.0from
goldmedal:feat/self-learning-skill
Apr 4, 2026
Merged

feat(cli-skills): strengthen self-learning guidance in wren-usage skill#1514
goldmedal merged 4 commits intoCanner:feat/cli-0.2.0from
goldmedal:feat/self-learning-skill

Conversation

@goldmedal
Copy link
Copy Markdown
Contributor

@goldmedal goldmedal commented Apr 4, 2026

Summary

  • Default-store: flip from "store only if confirmed" to "store unless there's a reason not to" — captures implicit confirmations from follow-up questions and silent-accept sessions
  • Step 2.5 — Assess complexity: new step before writing SQL that guides agents to decompose multi-metric / time-series questions into simpler sub-queries, each recalled and executed independently
  • Step 3 — dry-plan pre-verification: for complex queries (JOINs, subqueries, multi-step), verify with wren dry-plan before executing; simple queries still execute directly
  • Workflow 2 — structured error diagnosis: two-layer decision tree (MDL vs DB layer) with per-error-pattern fix tables, designed for small models that need explicit decision trees rather than open-ended "debug the query"

Files changed

File Change
cli-skills/wren-usage/SKILL.md Step 2.5 added; Step 3 enhanced; Step 4 rewritten; Workflow 2 structured
cli-skills/wren-usage/references/memory.md "Storing queries" rewritten as default-store; lifecycle example updated

Test plan

  • Review Step 4 and memory.md "Storing queries" — same exceptions, no contradiction
  • Review Step 2.5 "When NOT to decompose" — covers single-table GROUP BY, MDL-defined JOINs, near-exact recall match
  • Review Step 3 — simple query path is still direct execute, no redundant dry-plan step
  • Review Workflow 2 Layer 2A/2B tables — error patterns are distinct and non-overlapping

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Documentation
    • Added Step 2.5 to assess question complexity and optionally decompose multi-part questions into sub-queries.
    • Clarified Step 3: execute simple queries directly; validate complex queries before running them.
    • Changed memory behavior to auto-store successful, clearly phrased queries by default and listed explicit non-storage cases (failures, exploratory/throwaway, user opt-out).
    • Expanded error-recovery guidance into layered diagnostics for planning/semantic vs. DB/dialect issues.

Four prompt-level improvements to help agents learn more effectively:

- Default-store: flip from "store only if confirmed" to "store unless
  there's a reason not to" — captures implicit confirmations from
  follow-up questions and silent-accept sessions
- Step 2.5: complexity assessment + decomposition strategy before writing
  SQL — guides agents to split multi-metric / time-series questions into
  simpler sub-queries
- Step 3: dry-plan pre-verification for complex queries — lightweight
  generator/evaluator split without a second LLM
- Workflow 2: structured two-layer error diagnosis (MDL vs DB) with
  per-error-pattern fix tables — especially useful for small models that
  need an explicit decision tree

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions github-actions bot added the documentation Improvements or additions to documentation label Apr 4, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 4, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: fadfd8c9-e7c3-45c1-8abd-ef7aa7d77580

📥 Commits

Reviewing files that changed from the base of the PR and between c5036a8 and d4a5968.

📒 Files selected for processing (1)
  • cli-skills/wren-usage/SKILL.md

📝 Walkthrough

Walkthrough

Adds Step 2.5 for question complexity assessment and optional decomposition; splits execution into simple vs. complex with wren dry-plan validation for complex queries; changes result handling to auto-store successful NL-described queries via wren memory store; replaces single-step SQL error recovery with layered diagnostics and remediation. (49 words)

Changes

Cohort / File(s) Summary
SQL Workflow and Storage Guide
cli-skills/wren-usage/SKILL.md
Added Step 2.5 for complexity assessment/decomposition; refactored Step 3 into simple vs. complex execution paths and mandated wren dry-plan validation for complex queries; switched to default auto-store of successful NL-described queries with explicit skip cases; replaced single-step error recovery with layered diagnostics and iterative fixes; updated outcome table and "Things to avoid".
Memory Storage Decision Rules
cli-skills/wren-usage/references/memory.md
Changed wren memory store guidance to "store by default" for successful, clearly described NL queries; expanded "Store" and "Do NOT store" lists to include exploratory queries and failures; updated lifecycle example to reflect auto-store behavior.

Sequence Diagram(s)

sequenceDiagram
    participant User as User
    participant CLI as Wren-CLI
    participant Planner as Wren-dry-plan
    participant DB as Database
    participant Memory as Wren-Memory

    User->>CLI: Ask NL question
    CLI->>CLI: Assess complexity (Step 2.5)
    alt Simple query
        CLI->>DB: Execute SQL (--sql)
        DB-->>CLI: Results
    else Complex query
        CLI->>Planner: Validate SQL (wren dry-plan)
        Planner-->>CLI: Plan / errors
        alt Plan OK
            CLI->>DB: Execute SQL (--sql)
            DB-->>CLI: Results
        else Plan error
            CLI->>User: Layered diagnostics & remediation steps
        end
    end
    alt Successful & NL-described
        CLI->>Memory: wren memory store --nl ... --sql ...
        Memory-->>CLI: Stored
    else Failure / exploratory / user opt-out
        CLI-->>Memory: (skip storage)
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • douenergy

Poem

🐇 I hop through queries, sniff each clue,
I split tangled questions into bits few,
I dry-plan the roads, then run what is true,
I tuck results away when the meaning's in view,
A carrot for clarity — tidy and new. 🥕

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat(cli-skills): strengthen self-learning guidance in wren-usage skill' accurately captures the main purpose of the PR, which centers on improving the guidance for query handling, complexity assessment, and storage behavior in the wren-usage skill.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
cli-skills/wren-usage/SKILL.md (1)

225-225: ⚠️ Potential issue | 🟡 Minor

Decision-tree wording is stale with the new default-store policy.

Line 225 says “Store confirmed query,” which conflicts with Step 4’s store-by-default behavior.

Suggested wording update
-Store confirmed query   → wren memory store --nl "..." --sql "..."
+Store successful query (default) → wren memory store --nl "..." --sql "..."
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@cli-skills/wren-usage/SKILL.md` at line 225, Update the decision-tree wording
that currently reads "Store confirmed query" to reflect the new store-by-default
policy: replace that label with a phrase like "Store confirmed query (stored by
default — use --no-store to opt out)" and ensure any nearby reference to Step 4
clarifies that storing is the default behavior; update the CLI example line "→
wren memory store --nl \"...\" --sql \"...\"" or its caption if necessary to
indicate the default-store semantics and mention the flag to opt out.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@cli-skills/wren-usage/SKILL.md`:
- Around line 106-110: The "**Skip storing only when:**" list omits the "no NL
question/raw SQL" condition; edit that section to add a bullet like "The user
asked a no‑NL question or provided raw SQL (do not store)" so it matches the
exclusion described in memory.md, ensuring the wording aligns with the existing
rule in memory.md to prevent conflicting agent behavior.

---

Outside diff comments:
In `@cli-skills/wren-usage/SKILL.md`:
- Line 225: Update the decision-tree wording that currently reads "Store
confirmed query" to reflect the new store-by-default policy: replace that label
with a phrase like "Store confirmed query (stored by default — use --no-store to
opt out)" and ensure any nearby reference to Step 4 clarifies that storing is
the default behavior; update the CLI example line "→ wren memory store --nl
\"...\" --sql \"...\"" or its caption if necessary to indicate the default-store
semantics and mention the flag to opt out.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a6dc0701-fc88-4f96-8af3-df97628f9a36

📥 Commits

Reviewing files that changed from the base of the PR and between b086576 and ffda126.

📒 Files selected for processing (2)
  • cli-skills/wren-usage/SKILL.md
  • cli-skills/wren-usage/references/memory.md

…ry.md

Add the missing "no NL question / raw SQL" exclusion to SKILL.md Step 4
so both files list the same five skip conditions and agents see no conflict.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@cli-skills/wren-usage/SKILL.md`:
- Around line 69-75: The README's "Step 3" description calls simple queries
"single table" but the example invoked by wren --sql ('SELECT c_name,
SUM(o_totalprice) FROM orders JOIN customer ON orders.o_custkey =
customer.c_custkey GROUP BY 1 ORDER BY 2 DESC LIMIT 5') uses a JOIN; reconcile
this by either updating the Step 3 text to allow "single-table or simple
MDL-defined joins" (referencing the Step 2.5 note about "Simple JOINs") or by
replacing the example with a true single-table query (e.g., SELECT with GROUP BY
on one table) so the wording and the example are consistent.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 1c2b99eb-79ec-4402-9b28-cbba95cfbc15

📥 Commits

Reviewing files that changed from the base of the PR and between ffda126 and 2107edf.

📒 Files selected for processing (1)
  • cli-skills/wren-usage/SKILL.md

The description said "single table" but the example used a JOIN. Updated
to "single table or simple MDL-defined JOINs" to match both the example
and the Step 2.5 decomposition guidance.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@cli-skills/wren-usage/SKILL.md`:
- Around line 77-78: Update the wording that classifies JOINs as complex so it
no longer overlaps with the "simple MDL-defined JOINs" rule: replace the broad
"JOINs" phrase on the complex-queries guidance with "non-trivial joins (e.g.,
non‑MDL-defined joins, multi-join chains, or joins combined with
subqueries/CTEs)" and explicitly state that MDL-defined/simple joins are still
handled as simple queries to prevent ambiguity between the entries referenced as
"simple MDL-defined JOINs" and the complex-query guidance.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 042c457b-a3f0-4c50-abe7-bcf90117f69d

📥 Commits

Reviewing files that changed from the base of the PR and between 2107edf and c5036a8.

📒 Files selected for processing (1)
  • cli-skills/wren-usage/SKILL.md

…h simple MDL JOINs

"JOINs" was too broad — MDL-defined JOINs should still go through the
simple/direct path. Tighten to "non-trivial JOINs not covered by MDL
relationships" to keep simple vs complex paths non-overlapping.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@goldmedal goldmedal changed the base branch from main to feat/cli-0.2.0 April 4, 2026 12:25
@goldmedal goldmedal merged commit b126b30 into Canner:feat/cli-0.2.0 Apr 4, 2026
5 checks passed
@goldmedal goldmedal deleted the feat/self-learning-skill branch April 4, 2026 12:29
goldmedal added a commit that referenced this pull request Apr 4, 2026
…ll (#1514)

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant