feat: self-improving skills — agent-proposed updates with diff review, version history, and rollback (#355)#350
Merged
Conversation
…, version history, and rollback Phase 5 of the Hermes-Inspired Agent Intelligence MEGAPLAN. ## What's new ### Data layer - skill_versions: immutable content snapshots on every save (initial + updates) - skill_update_proposals: agent-submitted diff-based update requests - skill_load_events: adds flagged_reason/flagged_at columns for unhelpful signals ### Models - SkillVersion: snapshot! class method, chronological/reverse_chronological scopes - SkillUpdateProposal: pending/approved/rejected status, stale? detection - Skill: after_create/after_update callbacks snapshot versions automatically; skip_auto_snapshot! lets UpdateApprover create a richer version with proposal linkage ### Services - Skills::UpdateProposer: validates and persists a pending SkillUpdateProposal, raises an ApprovalRequest for admin notification - Skills::UpdateApprover: applies proposed_content to skill, creates SkillVersion with agent attribution and proposal link, marks proposal approved - Skills::UpdateRejector: closes a proposal as rejected, resolves ApprovalRequest - Skills::Rollback: restores skill content from a target SkillVersion, creates a new 'rollback' version so history stays linear ### Agent tools (MCP) - propose_skill_update: submit full updated content + rationale for a named skill - flag_skill_unhelpful: record a negative signal after loading a skill, with reason ### Admin UI - /skills/update_proposals — list pending/approved/rejected update proposals with side-by-side original vs proposed diff view and approve/reject actions - /skills/:id/history — full version timeline with rollback buttons per version - Skills index and show pages linked to the new sections - Update Proposals counter badge on the skills index nav ### Seeds - Two new built-in tools seeded: propose_skill_update, flag_skill_unhelpful ### Specs - 6 new service specs (UpdateProposer, UpdateApprover, UpdateRejector, Rollback, ProposeSkillUpdateExecutor, FlagSkillUnhelpfulExecutor) - 2 new model specs (SkillVersion, SkillUpdateProposal) - 3 new factories (skill_versions, skill_update_proposals, skill_load_events)
…s entry The chat_attachments tool entry was missing a trailing comma before the Phase 5 self-improving skills section, causing a Ruby syntax error at line 968 that broke both test and system-test CI jobs. Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Phase 5 of the Hermes-Inspired Agent Intelligence MEGAPLAN. Agents can now propose improvements to existing skills, admins review a side-by-side diff, and every content change is versioned with rollback capability.
propose_skill_updatetool — no skill is modified until an admin approvesskill_versionswith source attribution and proposal linkage/skills/update_proposalslists pending proposals with side-by-side original/proposed diff, approve/reject actions with optional notes/skills/:id/historyshows the full version timeline; any prior version can be restored in one click (creates a new 'rollback' version so history stays linear)flag_skill_unhelpfulto record that a skill didn't help, with a reason — visible improvement signal for adminsDeliverables
Data
skill_versionstable — immutable content snapshotsskill_update_proposalstable — pending/approved/rejected agent-submitted diffsflagged_reason+flagged_atcolumns onskill_load_eventsModels
SkillVersionwithsnapshot!class methodSkillUpdateProposalwithstale?detection (skill changed after proposal)Skillextended withhas_manyassociations and auto-snapshot callbacksServices
Skills::UpdateProposer— validates + persists pending proposalSkills::UpdateApprover— applies content, creates attributed version, resolves ApprovalRequestSkills::UpdateRejector— closes proposal, resolves ApprovalRequestSkills::Rollback— restores content from target version, creates rollback versionAgent tools
propose_skill_updateexecutor + seedflag_skill_unhelpfulexecutor + seedAdmin UI
GET /skills/update_proposals— proposal list with diff viewPATCH /skill_update_proposals/:id/approve_update_proposalPATCH /skill_update_proposals/:id/reject_update_proposalGET /skills/:id/history— version timeline with rollback buttonsPATCH /skills/:id/rollback— restore to versionSpecs
Test plan
bin/rspec spec/models/skill_version_spec.rb spec/models/skill_update_proposal_spec.rbbin/rspec spec/services/skills/update_proposer_spec.rb spec/services/skills/update_approver_spec.rb spec/services/skills/update_rejector_spec.rb spec/services/skills/rollback_spec.rbbin/rspec spec/services/tools/propose_skill_update_executor_spec.rb spec/services/tools/flag_skill_unhelpful_executor_spec.rbbin/rails routesshows history/rollback/update_proposals/approve/reject routes