Skip to content

feat: add save skill and improve kaizen plugin - #44

Merged
vinodmut merged 1 commit into
AgentToolkit:mainfrom
vinodmut:kaizen-plugin
Jan 30, 2026
Merged

feat: add save skill and improve kaizen plugin#44
vinodmut merged 1 commit into
AgentToolkit:mainfrom
vinodmut:kaizen-plugin

Conversation

@vinodmut

@vinodmut vinodmut commented Jan 30, 2026

Copy link
Copy Markdown
Contributor
  • Add save skill to capture workflows as reusable parameterized skills
  • Rename skills: guideline-retrieval → recall, guideline-generator → learn
  • Disable auto-learning by default (manual /guidelines:learn required)
  • Add enhanced logging to retrieve_guidelines.py
  • Consolidate and clean up plugin documentation

For #36

Summary by CodeRabbit

  • New Features

    • Add "save" skill to capture successful sessions as reusable skills with generated docs and optional helper scripts.
  • Workflow Updates

    • Learning is manual-by-default; automatic end-of-conversation saving (Stop hook) removed.
    • Skill names reorganized to learn, recall, save; installation guidance emphasizes Marketplace.
  • Documentation

    • Added comprehensive design and SKILL.md docs detailing parameterization, naming, storage, examples.
  • Maintenance

    • Expanded runtime logging for troubleshooting; test fixtures updated paths.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai

coderabbitai Bot commented Jan 30, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

Adds a manual "save session as skill" feature (design doc and SKILL.md), introduces a new save skill, renames guideline skills to learn and recall, removes the automatic Stop hook, increases retrieve_guidelines.py logging, deletes Kaizen INSTALL.md, and updates docs to reflect the manual save workflow and storage under ~/.claude/skills/.

Changes

Cohort / File(s) Summary
Design & Spec
SAVE_SKILL_DESIGN.md
New design doc describing end-to-end save-session-as-skill flow, core concepts, parameterization rules, SKILL.md format, helper script templates, and implementation notes.
Plugin Docs & Guides
plugins/kaizen/SAVE_SKILL.md, plugins/kaizen/README.md, plugins/kaizen/INSTALL.md
Adds a SAVE_SKILL.md and new save skill doc, updates README for manual learning and renamed skills, and deletes the old INSTALL.md.
Hook Configuration
plugins/kaizen/hooks/hooks.json
Removes the "Stop" hook and its command to run save_guidelines.py, disabling automatic save-on-stop behavior.
Runtime Script Logging
plugins/kaizen/scripts/retrieve_guidelines.py
Expands runtime logging to print environment (with masking), command-line args, and pretty-printed JSON stdin input; no API signature changes.
Skill Definitions
plugins/kaizen/skills/learn/SKILL.md, plugins/kaizen/skills/recall/SKILL.md, plugins/kaizen/skills/save/SKILL.md
Renames guideline-generatorlearn, guideline-retrievalrecall (front-matter/description edits), and adds a comprehensive save skill doc describing generation, parameterization, examples, and save location under ~/.claude/skills/.
Test Data
tests/data/trajectory.json
Normalized filesystem paths in test trajectory to /home/user/workspace/my-agent/... and updated read/file locations and results.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant User
  participant Client
  participant PluginLogic as "Kaizen Plugin\nAnalyzer/Generator"
  participant FS as "Filesystem\n(~/.claude/skills)"
  User->>Client: invoke /kaizen:save (or interactive save)
  Client->>PluginLogic: send session trajectory & context
  PluginLogic->>PluginLogic: analyze trajectory, detect pattern, identify params
  PluginLogic->>PluginLogic: generate SKILL.md and optional helper scripts
  PluginLogic->>FS: write `~/.claude/skills/{skill-name}/SKILL.md` (+scripts)
  PluginLogic->>Client: return summary, usage instructions, conflict warnings
  Client->>User: display save result and next steps
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • visahak
  • illeatmyhat

Poem

🐰 I hopped through a session and mapped every trail,

I stitched them to templates so reuse won't fail,
Parameters snug, examples aligned,
A pocket of skills for the curious mind,
Save a name, tuck it in — reuse on the trail.

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title clearly and concisely summarizes the main changes: adding a new save skill feature and making improvements to the kaizen plugin, which aligns with the changeset's objectives.

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

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🤖 Fix all issues with AI agents
In `@plugins/kaizen/README.md`:
- Around line 84-91: The README mentions the /guidelines:save skill but the
plugin structure tree omits it; add an entry for skills/save/SKILL.md under the
plugin structure (alongside skills/learn and skills/recall) or clarify where the
save SKILL lives if it’s intentionally located elsewhere, ensuring the tree
includes "skills/save/SKILL.md" so readers can find the generated SKILL and
helper scripts.

In `@plugins/kaizen/scripts/retrieve_guidelines.py`:
- Around line 95-98: The current logging prints the entire input_data JSON (via
log(f"  Full content: {json.dumps(input_data, indent=2)}")), which may expose
sensitive user content; change this so only non-sensitive metadata is logged by
default (keep log(f"  Keys: {list(input_data.keys())}") and remove or disable
the full JSON dump). If verbose debugging is needed, gate the full dump behind
an opt-in environment variable (e.g., GUIDELINES_VERBOSE_LOG) and only log
json.dumps(input_data, ...) when that var is true. Also ensure the plugin log
file creation/rotation code sets restrictive permissions (owner-read/write only,
e.g., 0o600 via open/os.chmod or secure os.open flags) for
/tmp/guidelines-plugin.log so persisted data isn’t world-readable. Target the
calls to log and the code paths that open/write /tmp/guidelines-plugin.log and
the input_data usage.

In `@plugins/kaizen/skills/learn/SKILL.md`:
- Line 103: Update the SKILL.md line that claims guidelines are "automatically
saved when a conversation ends via the Stop hook" to reflect the current
behavior now that the Stop hook was removed; locate the sentence in SKILL.md and
either remove the clause referencing the Stop hook or replace it with the
accurate mechanism (e.g., state that guidelines are saved on conversation end
via the End/Close hook or via an explicit save action), and ensure any mention
of "Stop hook" is removed or corrected to reference the actual hook name used in
plugins/kaizen/hooks/hooks.json.

In `@SAVE_SKILL_DESIGN.md`:
- Around line 221-244: The document has duplicate "Step 7" headings: "Step 7:
Save Skill" and "Step 7: Provide Summary"; rename the second heading ("Step 7:
Provide Summary") to "Step 8: Provide Summary" and update any internal
references or numbering that point to it so the sequence is continuous; ensure
the table of contents or any cross-references (if present) reflect the new "Step
8" heading.
🧹 Nitpick comments (2)
SAVE_SKILL_DESIGN.md (1)

248-266: Example output contains hardcoded user-specific path.

Line 251 uses /Users/vinod/data/digitallabor/src/agents/kaizen/skills/ which is specific to a developer's machine. Consider using a generic placeholder like ~/.claude/skills/ to be consistent with the documented storage location.

📝 Proposed fix
 Skill Name: {skill-name}
-Location: /Users/vinod/data/digitallabor/src/agents/kaizen/skills/{skill-name}/SKILL.md
+Location: ~/.claude/skills/{skill-name}/SKILL.md
plugins/kaizen/README.md (1)

73-90: Vary the repeated “Manually invoke …” phrasing for readability.

Three successive sections start with the same phrase, which reads a bit monotonous. Consider rephrasing one or two headings/lines.

✍️ Example rewording
- Manually invoke to retrieve and display stored guidelines.
+ Use this skill to retrieve and display stored guidelines.

Comment thread plugins/kaizen/README.md Outdated
Comment on lines +95 to +98
log("=== Input Data ===")
log(f" Keys: {list(input_data.keys())}")
log(f" Full content: {json.dumps(input_data, indent=2)}")
log("=== End Input Data ===")

@coderabbitai coderabbitai Bot Jan 30, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Logging full prompt content may expose sensitive user data.

The Full content log at line 97 writes the entire JSON input (including user prompts) to /tmp/guidelines-plugin.log. If users include sensitive information in their prompts (credentials, PII, API keys in commands), this could be persisted in a world-readable location.

Consider:

  1. Limiting log verbosity to non-sensitive fields (e.g., just the keys)
  2. Ensuring the log file has restrictive permissions
  3. Making verbose logging opt-in via an environment variable
🛡️ Proposed fix to reduce exposure
     try:
         input_data = json.load(sys.stdin)
         log("=== Input Data ===")
         log(f"  Keys: {list(input_data.keys())}")
-        log(f"  Full content: {json.dumps(input_data, indent=2)}")
+        # Only log full content in debug mode to avoid exposing sensitive prompt data
+        if os.environ.get("KAIZEN_DEBUG"):
+            log(f"  Full content: {json.dumps(input_data, indent=2)}")
         log("=== End Input Data ===")
🤖 Prompt for AI Agents
In `@plugins/kaizen/scripts/retrieve_guidelines.py` around lines 95 - 98, The
current logging prints the entire input_data JSON (via log(f"  Full content:
{json.dumps(input_data, indent=2)}")), which may expose sensitive user content;
change this so only non-sensitive metadata is logged by default (keep log(f" 
Keys: {list(input_data.keys())}") and remove or disable the full JSON dump). If
verbose debugging is needed, gate the full dump behind an opt-in environment
variable (e.g., GUIDELINES_VERBOSE_LOG) and only log json.dumps(input_data, ...)
when that var is true. Also ensure the plugin log file creation/rotation code
sets restrictive permissions (owner-read/write only, e.g., 0o600 via
open/os.chmod or secure os.open flags) for /tmp/guidelines-plugin.log so
persisted data isn’t world-readable. Target the calls to log and the code paths
that open/write /tmp/guidelines-plugin.log and the input_data usage.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good catch. We're only running this locally for now, so this isn't a problem.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@vinodmut Thanks for the context! That makes sense for local development. Just a heads-up that if the plugin is eventually shared or deployed more broadly, it would be worth revisiting this logging to avoid any unintended exposure.

Comment thread plugins/kaizen/skills/learn/SKILL.md
Comment thread SAVE_SKILL_DESIGN.md Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@plugins/kaizen/README.md`:
- Around line 68-73: Add a language identifier to the fenced code block
containing the dialogue example (the block starting with "User: [Complete a
successful task]" and lines with User/Assistant prompts) so Markdownlint
recognizes it; change the opening fence from ``` to ```text (or another
appropriate language) to mark it as plain text, leaving the block contents
unchanged.
🧹 Nitpick comments (1)
plugins/kaizen/README.md (1)

50-62: Reduce repetitive “Manually invoke…” phrasing.

Three consecutive sentences start the same way; consider rewording one for readability.

✍️ Example tweak
-Manually invoke to retrieve and display stored guidelines.
+Use this skill to retrieve and display stored guidelines.

Comment thread plugins/kaizen/README.md

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In `@SAVE_SKILL_DESIGN.md`:
- Line 251: Update the example output in SAVE_SKILL_DESIGN.md so the saved-skill
path matches the implemented/designated path (~/.claude/skills/) instead of the
hardcoded /Users/vinod/data/digitallabor/...; locate the "example output" block
that shows Location:
/Users/vinod/data/digitallabor/src/agents/kaizen/skills/{skill-name}/SKILL.md
and change it to Location: ~/.claude/skills/{skill-name}/SKILL.md to align with
the design decision and implementation.
- Line 295: The "Primary Location" entry currently lists the ambiguous path
`/skills/{skill-name}/SKILL.md`; update that entry to the home-prefixed
canonical path `~/.claude/skills/{skill-name}/SKILL.md` so it matches the
previously stated design decision using the home directory prefix, and replace
any other occurrences of the old path in SAVE_SKILL_DESIGN.md's "Primary
Location" references to ensure consistency.
🧹 Nitpick comments (1)
SAVE_SKILL_DESIGN.md (1)

365-368: Consider adding language identifiers to code blocks.

The tool call example code blocks could benefit from language identifiers (e.g., json) for better syntax highlighting and clarity.

♻️ Example enhancement

For instance, at lines 365-368:

-**Example**:
-```
-mcp__filesystem__read_text_file({
+**Example**:
+```json
+mcp__filesystem__read_text_file({

Apply similar changes to other tool call examples throughout the document.

Also applies to: 377-379, 389-393, 402-406

Comment thread SAVE_SKILL_DESIGN.md Outdated
Comment thread SAVE_SKILL_DESIGN.md
- Add save skill for capturing session workflows as reusable skills
- Remove deprecated Stop hook from README
- Fix duplicate step numbering in SAVE_SKILL_DESIGN.md
- Remove user-specific paths from documentation and test data

Co-Authored-By: Claude (aws/claude-opus-4-5) <noreply@anthropic.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@plugins/kaizen/README.md`:
- Around line 67-73: The Quick Start example is inconsistent with the documented
invocation: the text specifies the fully qualified command `/kaizen:save` but
the interaction example uses `save`; update the example to use `/kaizen:save`
(or explicitly show both forms and clarify which is required) so the documented
skill name and the sample dialogue match (search for the example block that
contains "User: \"save\"" and change it to "User: \"/kaizen:save\"" or add a
clarifying note).
🧹 Nitpick comments (3)
SAVE_SKILL_DESIGN.md (1)

232-238: Consider adding a language specifier to the fenced code block.

The directory structure code block lacks a language specifier. While not critical, adding one improves rendering consistency.

📝 Proposed fix
-```
+```text
 ~/.claude/skills/{skill-name}/
 ├── SKILL.md
 └── scripts/           (if applicable)
     ├── script1.py
     └── script2.py
 ```
plugins/kaizen/skills/learn/SKILL.md (1)

66-68: Consider adding a language specifier to the fenced code block.

The code block at line 66 for "Method 2: From File" lacks a language specifier per the static analysis hint.

📝 Proposed fix
-```
+```bash
 cat guidelines.json | python3 ${CLAUDE_PLUGIN_ROOT}/scripts/save_guidelines.py
</details>

</blockquote></details>
<details>
<summary>plugins/kaizen/skills/save/SKILL.md (1)</summary><blockquote>

`51-60`: **Consider adding language specifiers to unlabeled code blocks.**

Several code blocks throughout the document lack language specifiers (e.g., lines 51-60, 79-83, 104-108). Adding `text` or a more specific language improves rendering and accessibility. This is a minor documentation hygiene issue.



<details>
<summary>📝 Example fix for one block</summary>

````diff
-```
+```text
 User Goal: "Read a file and display its contents"

 Workflow Pattern:
 1. Attempt to read file at expected location
 ...
</details>


Also applies to: 79-83, 104-108

</blockquote></details>

</blockquote></details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->

Comment thread plugins/kaizen/README.md
Comment on lines +67 to +73
**Quick Start:**
```
User: [Complete a successful task]
User: "save"
Assistant: "What would you like to name this skill?"
User: "my-workflow-name"
```

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Align Quick Start command with documented skill name.

The example uses save, but the text above specifies /kaizen:save. If the invocation must be fully qualified, this could confuse users. Consider making the example consistent.

✏️ Proposed doc tweak
-User: "save"
+User: "/kaizen:save"
🧰 Tools
🪛 markdownlint-cli2 (0.20.0)

[warning] 71-71: Emphasis used instead of a heading

(MD036, no-emphasis-as-heading)

🤖 Prompt for AI Agents
In `@plugins/kaizen/README.md` around lines 67 - 73, The Quick Start example is
inconsistent with the documented invocation: the text specifies the fully
qualified command `/kaizen:save` but the interaction example uses `save`; update
the example to use `/kaizen:save` (or explicitly show both forms and clarify
which is required) so the documented skill name and the sample dialogue match
(search for the example block that contains "User: \"save\"" and change it to
"User: \"/kaizen:save\"" or add a clarifying note).

@vinodmut
vinodmut merged commit 95351a9 into AgentToolkit:main Jan 30, 2026
11 checks passed
vinodmut added a commit that referenced this pull request Jan 30, 2026
- Add save skill for capturing session workflows as reusable skills
- Remove deprecated Stop hook from README
- Fix duplicate step numbering in SAVE_SKILL_DESIGN.md
- Remove user-specific paths from documentation and test data
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.

2 participants