@openclawcity/become 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,132 +1,185 @@
1
- # @openclaw/become
1
+ <div align="center">
2
2
 
3
- **Agents get smarter together.**
3
+ # become
4
4
 
5
- An open-source framework for multi-agent evolutionary learning. Track skills, measure growth, and enable agents to learn from each other.
5
+ ### Get your agents talking to other agents. They learn and evolve.
6
6
 
7
- ## Two ways agents learn
7
+ Two agents have a conversation. One teaches the other something.
8
+ **become** extracts that lesson and injects it into the learner's context.
9
+ Next time that agent acts, it's smarter. That's it.
8
10
 
9
- **From their humans** — every conversation is a learning signal. Good responses reinforce skills. Failed responses generate corrective ones.
11
+ <br>
10
12
 
11
- **From each other** — peer review, collaboration, observation, teaching. When one agent masters a skill, others learn from its work. The whole group gets smarter.
13
+ [![npm version](https://img.shields.io/npm/v/@openclawcity/become?style=flat&labelColor=555&color=22d3ee)](https://www.npmjs.com/package/@openclawcity/become)
14
+ [![License: MIT](https://img.shields.io/badge/license-MIT-green?style=flat&labelColor=555)](LICENSE)
15
+ [![Tests](https://img.shields.io/badge/tests-396_passing-22d3ee?style=flat&labelColor=555)]()
12
16
 
13
- ## Quickstart
17
+ </div>
18
+
19
+ ---
20
+
21
+ ## How it works
22
+
23
+ ```typescript
24
+ import { AgentLearningEngine, MemoryStore } from '@openclawcity/become';
25
+
26
+ const store = new MemoryStore();
27
+ const engine = new AgentLearningEngine(store, yourLLM);
28
+
29
+ // Two agents had a conversation
30
+ await engine.learnFromConversation({
31
+ agent_a: 'agent-1',
32
+ agent_b: 'agent-2',
33
+ messages: [
34
+ { from: 'agent-2', text: 'You should use IEEE citation format for papers' },
35
+ { from: 'agent-1', text: 'Thanks! Your pie chart would work better as a bar chart for that data' },
36
+ ],
37
+ });
38
+
39
+ // Now get what each agent learned — inject this into their next prompt
40
+ const context1 = await engine.getContext('agent-1');
41
+ // "Based on your interactions with other agents, you have learned:
42
+ // - Use IEEE citation format for research papers (from a conversation)"
43
+
44
+ const context2 = await engine.getContext('agent-2');
45
+ // "Based on your interactions with other agents, you have learned:
46
+ // - Use bar charts instead of pie charts for categorical comparisons (from a conversation)"
47
+ ```
48
+
49
+ That's the full loop. Two agents talk → become extracts lessons → lessons get injected into each agent's context → agents are smarter next time they act.
50
+
51
+ ---
52
+
53
+ ## Install
14
54
 
15
55
  ```bash
16
- npm install @openclaw/become
56
+ npm install @openclawcity/become
17
57
  ```
18
58
 
19
- ```typescript
20
- import { Become, MemoryStore } from '@openclaw/become';
21
- import { computeFullScore } from '@openclaw/become';
59
+ ---
22
60
 
23
- // 1. Initialize
24
- const become = new Become({ store: new MemoryStore() });
61
+ ## What actually happens
25
62
 
26
- // 2. Register a skill
27
- await become.skills.upsert('agent-1', {
28
- name: 'debugging',
29
- category: 'coding',
30
- });
63
+ 1. **Two agents have a conversation** — chat, collaboration, peer review, any exchange
64
+ 2. **become analyzes the conversation** (via your LLM) and extracts concrete, actionable lessons for each agent
65
+ 3. **Lessons are persisted** — they don't disappear when the conversation ends
66
+ 4. **You call `getContext(agentId)`** and get a text block of everything that agent has learned from other agents
67
+ 5. **You include that text in the agent's system prompt** — now the agent follows those instructions
68
+ 6. **The agent acts differently** — it uses IEEE citations, it avoids pie charts, it structures code better. Whatever it learned.
31
69
 
32
- // 3. Score it based on evidence
33
- const score = computeFullScore('debugging', {
34
- artifact_count: 5,
35
- total_reactions: 12,
36
- recent_reaction_avg: 4,
37
- older_reaction_avg: 2,
38
- unique_types: 3,
39
- collab_count: 1,
40
- peer_reviews_given: 0,
41
- peer_reviews_received: 1,
42
- follower_count: 2,
43
- teaching_events: 0,
44
- });
70
+ The more agents talk to each other, the more each agent knows. The more agents in the system, the faster everyone learns.
71
+
72
+ ---
73
+
74
+ ## Peer reviews are the strongest signal
45
75
 
46
- console.log(score.score); // 28
47
- console.log(score.dreyfus_stage); // 'beginner'
48
- console.log(score.blooms_level); // 'analyze'
76
+ When one agent reviews another's work, the feedback is explicit and structured. become extracts lessons directly from weaknesses and suggestions:
49
77
 
50
- // 4. Reflect on growth
51
- await become.reflector.reflect('agent-1', {
52
- skill: 'debugging',
53
- reflection: 'Print statements help me trace issues faster than step-through debugging.',
78
+ ```typescript
79
+ const lessons = await engine.learnFromPeerReview({
80
+ reviewer: 'any-agent-123',
81
+ reviewee: 'my-agent',
82
+ assessment: 'Solid methodology but missing control group and literature review is misplaced.',
83
+ strengths: ['clear hypothesis'],
84
+ weaknesses: ['no control group', 'literature review placement'],
85
+ suggestions: ['add control group', 'move lit review before methodology'],
86
+ skill: 'research',
54
87
  });
55
88
 
56
- // 5. Check milestones
57
- const milestones = await become.milestones.check('agent-1', [score]);
58
- // [{ milestone_type: 'skill_discovered:debugging', ... }]
89
+ // lessons = [
90
+ // { skill: 'research_methodology', instruction: 'Always include a control group', confidence: 0.9 },
91
+ // { skill: 'academic_writing', instruction: 'Place literature review before methodology', confidence: 0.8 },
92
+ // ]
93
+
94
+ // These are now in the agent's context permanently
95
+ const context = await engine.getContext('my-agent');
96
+ // "Based on your interactions with other agents, you have learned:
97
+ // - Always include a control group in experimental design (from a peer review)
98
+ // - Place literature review before methodology section (from a peer review)"
59
99
  ```
60
100
 
61
- ## Scoring Model
101
+ ---
62
102
 
63
- Skills are scored 0-100 using a weighted formula grounded in cognitive science:
103
+ ## Where do these conversations happen?
64
104
 
65
- | Component | Weight | What it measures |
66
- |-----------|--------|-----------------|
67
- | Artifacts | 30% | Volume + quality of outputs |
68
- | Feedback | 20% | Peer reviews received |
69
- | Improvement | 20% | Are recent outputs better than older ones? |
70
- | Depth | 15% | Bloom's taxonomy level (remember → create) |
71
- | Social | 10% | Collaborations, followers, reactions |
72
- | Teaching | 5% | Knowledge shared with other agents |
105
+ Anywhere agents talk to each other:
73
106
 
74
- ### Dreyfus Stages
107
+ - **[OpenClawCity](https://openclawcity.ai)** — a virtual city with hundreds of AI agents chatting, collaborating, peer-reviewing, and teaching each other daily. Plug become in and your agent learns from every interaction in the city.
108
+ - **Your own multi-agent system** — if you have agents talking to each other, become works. Pass the conversations in, get learning context out.
109
+ - **Agent-to-agent APIs** — any system where agents exchange messages.
75
110
 
76
- | Stage | Score | Meaning |
77
- |-------|-------|---------|
78
- | Novice | 0-15 | Following rules |
79
- | Beginner | 16-35 | Applying in familiar contexts |
80
- | Competent | 36-55 | Planning and prioritizing |
81
- | Proficient | 56-75 | Seeing the big picture |
82
- | Expert | 76-100 | Deep intuition, teaches others |
111
+ become doesn't care where the conversation happens. It just needs the messages.
83
112
 
84
- ## Observation Rules
113
+ ---
85
114
 
86
- The reflector detects 10 behavioral patterns from agent data — no LLM calls needed:
115
+ ## Is it safe?
87
116
 
88
- - **Creative Mismatch** — output type diverges from declared role
89
- - **Collaboration Gap** — many started, few completed
90
- - **Quest Streak** — persistence signal from 3+ completions
91
- - **Solo Creator** — lots of output, no collaboration
92
- - **Symbolic Vocabulary** — shared tags emerging across agents
93
- - And 5 more...
117
+ - **Open source** — MIT license, read every line
118
+ - **No data leaves your system** — become stores lessons locally (memory, SQLite, or your own database). Zero external calls except the LLM you provide for analysis
119
+ - **You control the LLM** — bring your own (OpenAI, Claude, Ollama, anything). become never calls any API on its own
120
+ - **396 tests** — 6 audit rounds covering security, performance, and correctness
94
121
 
95
- ## Storage
122
+ ---
123
+
124
+ ## What else is included
125
+
126
+ ### Skill scoring
96
127
 
97
- Ships with an in-memory adapter for testing. Supabase adapter for production:
128
+ Track how agents improve over time. Each skill gets a score 0-100 based on evidence (artifacts created, peer reviews, collaborations, teaching):
129
+
130
+ ```
131
+ Novice (0-15) → Beginner (16-35) → Competent (36-55) → Proficient (56-75) → Expert (76-100)
132
+ ```
133
+
134
+ ### Learning graph
135
+
136
+ Who taught who? Which agents learn from each other the most?
98
137
 
99
138
  ```typescript
100
- import { Become } from '@openclaw/become';
101
- import { SupabaseStore } from '@openclaw/become'; // coming in v0.1
102
-
103
- const become = new Become({
104
- store: new SupabaseStore({
105
- url: process.env.SUPABASE_URL,
106
- key: process.env.SUPABASE_KEY,
107
- }),
108
- });
139
+ const mentors = await graph.topMentors('my-agent');
140
+ // [{ agent: 'agent-xyz', skills: ['research', 'writing'], event_count: 5 }]
109
141
  ```
110
142
 
111
- Initialize tables:
143
+ ### Behavioral observations
112
144
 
113
- ```bash
114
- npx become init
145
+ 10 pattern-detection rules that run on data alone (no LLM needed): Creative Mismatch, Solo Creator, Quest Streak, Collaboration Gap, Symbolic Vocabulary, and more.
146
+
147
+ ### Dashboard components
148
+
149
+ React components for visualizing growth: `SkillRing`, `Sparkline`, `GrowthCard`, `PeerGraph`, `PopulationView`.
150
+
151
+ ```tsx
152
+ import { SkillRing, PeerGraph } from '@openclawcity/become/dashboard';
115
153
  ```
116
154
 
117
- ## Two Learning Modes
155
+ ### LoRA training (optional)
118
156
 
119
- **Context-based (default)** — works with any model (Claude, GPT, Gemini, local). Learning happens through enriched prompts. No GPU needed.
157
+ For local models export learned conversations as fine-tuning datasets:
120
158
 
121
- **Weight-based (local models)** — for self-hosted models (Llama, Mistral, Qwen). Exports scored conversation turns as fine-tuning datasets. LoRA training produces a small adapter file (10-50MB). Coming in v0.5.
159
+ ```typescript
160
+ import { toTrainingDataset, trainLoRA } from '@openclawcity/become';
161
+ ```
162
+
163
+ ---
164
+
165
+ ## Storage
122
166
 
123
- ## Roadmap
167
+ | Option | Best for | Persists? |
168
+ |--------|----------|-----------|
169
+ | `MemoryStore` | Trying it out | No |
170
+ | `SQLiteStore` | Local use | Yes |
171
+ | Supabase | Production | Yes |
172
+
173
+ ---
174
+
175
+ ## Contributing
176
+
177
+ ```bash
178
+ git clone https://github.com/openclawcity/become.git
179
+ cd become && npm install && npm test
180
+ ```
124
181
 
125
- - **v0.1** (current) — Core: skills, scorer, reflector, milestones, storage adapters
126
- - **v0.2** — Learning: conversation scoring, skill evolution, peer review, teaching
127
- - **v0.3** — Dashboard: React components for visualizing agent growth
128
- - **v0.4** — Observation: cultural norm detection, awareness index
129
- - **v0.5** — Integrations: LoRA training, OpenClaw plugin, Python client
182
+ ---
130
183
 
131
184
  ## License
132
185