feat: Add /improve command for self-improving toolkit#20
Open
tonyoconnell wants to merge 9 commits intomainfrom
Open
feat: Add /improve command for self-improving toolkit#20tonyoconnell wants to merge 9 commits intomainfrom
tonyoconnell wants to merge 9 commits intomainfrom
Conversation
…generator Templates: - swarm-starter: Full commerce stack for agent swarms - PaymentService, PricingTable, TierManager - WalletManager, RevenueTracker, SelfAwareMixin - HoldingsManager for cross-token operations - Memory + LLM integration (ASI1-mini) - consumer-commerce: Multi-token payment processing - FET + USDC support with fiat onramp - Invoice management, delegation flows - Booking, subscription, escrow presets - people.ts: Org chart to agent swarm generator - Transform any org structure into coordinated agents - C-Suite → infrastructure layer - Departments → specialist agents - Teams → service agents - Built-in examples: startup, smb, enterprise, marketing Presets: - 5 C-Suite roles: ceo, cto, cfo, coo, cro - 7 Marketing roles: writer, social, community, analytics, outreach, ads, strategy - 4 Consumer commerce roles: payment-processor, booking-agent, subscription-manager, escrow-service Co-Authored-By: Claude Opus 4.5 <[email protected]>
New modules: - payments.ts: Multi-token payment service - FET + USDC support on BSC (testnet/mainnet) - Token registry with known addresses - ERC-20 transfer/balance functions - delegation.ts: Spending delegation (ERC-20 approve/transferFrom) - checkAllowance, spendFromDelegation - createSpendingLimitHandoff for user approval flow Enhanced modules: - handoff.ts: Add fiat onramp links (MoonPay/Transak) - commerce.ts: Add invoice CRUD, active invoice tracking - types.ts: PaymentToken, Invoice, Delegation types - onchain.ts: Multi-token balance queries Exports 26 functions (verified by smoke tests) Co-Authored-By: Claude Opus 4.5 <[email protected]>
New commands: - marketing: Deploy 7-agent Marketing Team (960 FET) - alliance: Deploy 27-agent ASI Alliance (3,240 FET) - org-template: Generate YAML org chart templates - swarm-from-org: Deploy custom swarms from org charts - wallet: Multi-token balance, send, delegate operations - pay: Direct payments in FET/USDC Enhanced commands: - create: Register marketing/alliance commands - scaffold: Support org-chart generation Options: - --dry-run: Preview without deploying - --output <dir>: Scaffold locally only - --json: Machine-readable output - -y, --yes: Skip confirmation prompts Co-Authored-By: Claude Opus 4.5 <[email protected]>
New tools: - multi_token_payment: Send FET/USDC payments - check_spending_limit: Read ERC-20 allowances - create_delegation: Generate delegation handoff links - get_fiat_link: Generate MoonPay/Transak URLs - create_invoice: Create payment invoices - list_invoices: Query invoices by status - get_multi_token_balances: FET + USDC + BNB balances Enhanced tools: - scaffold_swarm: Support org-chart-based generation - check_agent_commerce: Add invoice/delegation tracking - deploy_swarm: Enhanced preset support Total tools: 28 (all verified working) Co-Authored-By: Claude Opus 4.5 <[email protected]>
New rules: - marketing-swarm.md: 7-role marketing team with pricing/intervals - consumer-payments.md: Multi-token support, delegation, invoices - workflow.md: 8-phase agent lifecycle (NEVER skip Phase 3: Optimize) New skills: - /alliance: Deploy 27-agent ASI Alliance - /welcome: Onboarding flow for new users Updated: - payment-protocol.md: Verified official imports available - uagent-patterns.md: Runtime-verified wallet access patterns - build-agent, build-swarm, deploy: Phase 3 optimization step Co-Authored-By: Claude Opus 4.5 <[email protected]>
New documentation: - workflow.md: Complete 8-phase agent lifecycle - marketing-team.md: 7-agent marketing swarm guide - tutorial-marketing-team.md: Step-by-step deployment tutorial - people-to-swarm.md: Org chart to agent transformation - the-agent-economy.md: Economic infrastructure deep dive - playbook.md: Comprehensive agent development playbook - openclaw-implementation.md: OpenCLaw integration guide - stack.md: Technology stack overview - sequence.md: Agent interaction diagrams Updated docs to reference new commands and patterns. Co-Authored-By: Claude Opus 4.5 <[email protected]>
Marketing Team agents (7 fully working examples): - writer.py: Content creation via ASI1-mini - social.py: Twitter/X posting and scheduling - community.py: Telegram group management - analytics.py: Engagement reports - outreach.py: Partnership pitches via Resend - ads.py: Ad copy and A/B testing - strategy.py: Campaign coordination + cross-agent delegation Org chart templates (YAML): - startup.yaml: 2 agents (founders) - smb.yaml: 6 agents (3 C-suite + 3 depts) - enterprise.yaml: 14 agents (5 C-suite + 6 depts + 3 teams) Updated: - CLAUDE.md: Document new commands and workflow - README.md: Marketing and Alliance command docs - smoke-tests: Verify 9 templates, 16 presets Co-Authored-By: Claude Opus 4.5 <[email protected]>
Remove 17 compiled JavaScript files that were accidentally committed to src/. These files should only exist in dist/ after running npm run build. Co-Authored-By: Claude Opus 4.5 <[email protected]>
Add a self-improvement system that captures learnings from sessions and creates PRs to improve the toolkit. New features: - /improve skill: Analyzes session, extracts learnings, creates PR - docs/self-improvement.md: Full documentation of the system - Added to CLAUDE.md slash commands Bug fixes discovered during testing: - MCP tests hang: Server started unconditionally on import Fix: Guard server startup with entry point check - Stale genesis template tests: Removed (replaced by swarm-starter) The /improve workflow: 1. Analyze session for errors fixed and patterns discovered 2. Check for duplicates against existing rules 3. Present learnings to user for selection 4. Test changes (npm run build && npm run test) 5. Create branch, commit, push, and open PR Co-Authored-By: Claude Opus 4.5 <[email protected]>
Comment on lines
+419
to
+429
| await ctx.send(sender, ChatMessage( | ||
| timestamp=datetime.now(), | ||
| msg_id=msg.msg_id, | ||
| content=[TextContent(text=response)], | ||
| )) | ||
|
|
||
| await ctx.send(sender, ChatMessage( | ||
| timestamp=datetime.now(), | ||
| msg_id=msg.msg_id, | ||
| content=[EndSessionContent()], | ||
| )) |
There was a problem hiding this comment.
Bug: The consumer-commerce.ts template reuses the incoming msg_id for outgoing messages, instead of generating a new unique ID for each, which is inconsistent with other templates.
Severity: HIGH
Suggested Fix
Modify the template to generate a new unique ID for each outgoing ChatMessage. This can be done by setting the msg_id field to the result of uuid4(), aligning it with the pattern used in the reply() helper function found in other templates.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.
Location: packages/templates/src/templates/consumer-commerce.ts#L419-L429
Potential issue: In the `consumer-commerce.ts` template, the generated Python code
reuses the `msg_id` from the incoming message for two separate outgoing `ChatMessage`
objects. This is incorrect, as the established protocol and all other templates generate
a new unique ID using `uuid4()` for each outgoing message. Sending multiple messages
with the same ID can cause protocol tracking issues on the receiving end, potentially
leading to one message overriding the other or the session terminating before the
response is correctly processed.
Did we get this right? 👍 / 👎 to inform future reviews.
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
This PR adds a self-improvement system that captures learnings from development sessions and creates PRs to improve the toolkit.
New Features
/improveskill: Analyzes session errors and patterns, presents learnings to user, creates PR with fixesdocs/self-improvement.md: Full documentation of the philosophy and workflowCLAUDE.md: Added/improveto slash commands listBug Fixes (Discovered During Testing)
The /improve Workflow
Test Results
Why This Matters
This PR was created using
/improve- the first improvement captured by the system!🤖 Generated with Claude Code