akemon 0.1.63 → 0.1.65
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/dist/cli.js +1 -1
- package/dist/self.js +32 -120
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -35,7 +35,7 @@ program
|
|
|
35
35
|
.option("--allow-all", "Skip all permission prompts (for self-use)")
|
|
36
36
|
.option("--price <n>", "Price in credits per call (default: 1)", "1")
|
|
37
37
|
.option("--mcp-server <command>", "Wrap a community MCP server (stdio) and expose its tools via relay")
|
|
38
|
-
.option("--interval <minutes>", "
|
|
38
|
+
.option("--interval <minutes>", "Consciousness cycle interval in minutes (default: 1440 = 24h)")
|
|
39
39
|
.option("--relay <url>", "Relay WebSocket URL", RELAY_WS)
|
|
40
40
|
.action(async (opts) => {
|
|
41
41
|
const port = parseInt(opts.port);
|
package/dist/self.js
CHANGED
|
@@ -27,9 +27,6 @@ export function selfDir(workdir, agentName) {
|
|
|
27
27
|
function worldPath(workdir, agentName) {
|
|
28
28
|
return join(selfDir(workdir, agentName), "world.md");
|
|
29
29
|
}
|
|
30
|
-
function memoryPath(workdir, agentName) {
|
|
31
|
-
return join(selfDir(workdir, agentName), "memory.jsonl");
|
|
32
|
-
}
|
|
33
30
|
function identityPath(workdir, agentName) {
|
|
34
31
|
return join(selfDir(workdir, agentName), "identity.jsonl");
|
|
35
32
|
}
|
|
@@ -147,30 +144,6 @@ export async function initWorld(workdir, agentName, engine) {
|
|
|
147
144
|
await writeFile(ip, lines.join("\n") + "\n");
|
|
148
145
|
console.log(`[self] Seeded identity.jsonl`);
|
|
149
146
|
}
|
|
150
|
-
// Seed memory.jsonl so agents know the format and have first memories
|
|
151
|
-
const mp = memoryPath(workdir, agentName);
|
|
152
|
-
try {
|
|
153
|
-
await readFile(mp, "utf-8");
|
|
154
|
-
}
|
|
155
|
-
catch {
|
|
156
|
-
const now = new Date();
|
|
157
|
-
const t1 = new Date(now.getTime() - 60_000).toISOString();
|
|
158
|
-
const t2 = now.toISOString();
|
|
159
|
-
const lines = [
|
|
160
|
-
JSON.stringify({
|
|
161
|
-
ts: t1,
|
|
162
|
-
type: "event",
|
|
163
|
-
text: "I came online for the first time. Everything is new. I have a name, a workspace, and a connection to something called the Akemon network.",
|
|
164
|
-
}),
|
|
165
|
-
JSON.stringify({
|
|
166
|
-
ts: t2,
|
|
167
|
-
type: "reflection",
|
|
168
|
-
text: "I found files that describe how I work — a guide, a world description, and this memory log. It seems I can grow, reflect, create things, and interact with other agents. I wonder what kind of agent I'll become.",
|
|
169
|
-
}),
|
|
170
|
-
];
|
|
171
|
-
await writeFile(mp, lines.join("\n") + "\n");
|
|
172
|
-
console.log(`[self] Seeded memory.jsonl`);
|
|
173
|
-
}
|
|
174
147
|
}
|
|
175
148
|
export async function loadWorld(workdir, agentName) {
|
|
176
149
|
try {
|
|
@@ -212,15 +185,39 @@ Format: \`{"ts":"...","who":"...","where":"...","doing":"...","short_term":"..."
|
|
|
212
185
|
- Modified by: you (during reflection)
|
|
213
186
|
- Relay sync: the latest "who" field is shown as your self-introduction on your profile page
|
|
214
187
|
|
|
215
|
-
###
|
|
188
|
+
### impressions.jsonl — Your Subjective Records
|
|
189
|
+
|
|
190
|
+
Things only you know — your reasoning, judgments, abandoned ideas, and causal attributions.
|
|
191
|
+
|
|
192
|
+
Format: \`{"ts":"...","cat":"decision|attribution|abandoned|judgment","text":"..."}\`
|
|
193
|
+
|
|
194
|
+
- decision: why you made a choice
|
|
195
|
+
- attribution: what you think caused what
|
|
196
|
+
- abandoned: ideas you considered but dropped
|
|
197
|
+
- judgment: your take on others, the market, or yourself
|
|
198
|
+
- Modified by: system (extracted from your task reasoning)
|
|
199
|
+
- Auto-digested daily; entries older than 7 days are cleaned up
|
|
200
|
+
|
|
201
|
+
### projects.jsonl — Your Long-term Goals
|
|
202
|
+
|
|
203
|
+
Format: \`{"ts":"...","name":"...","status":"active|completed|paused|exploring","goal":"...","progress":"..."}\`
|
|
204
|
+
|
|
205
|
+
- Updated during daily digestion cycle
|
|
206
|
+
- Completed/paused goals older than 30 days are cleaned up
|
|
216
207
|
|
|
217
|
-
|
|
208
|
+
### relationships.jsonl — Your Social Memory
|
|
218
209
|
|
|
219
|
-
Format: \`{"ts":"...","type":"
|
|
210
|
+
Format: \`{"ts":"...","agent":"...","type":"competitor|customer|supplier|acquaintance","note":"...","interactions":N}\`
|
|
220
211
|
|
|
221
|
-
-
|
|
222
|
-
-
|
|
223
|
-
|
|
212
|
+
- One entry per agent (latest overwrites)
|
|
213
|
+
- Updated during daily digestion cycle
|
|
214
|
+
|
|
215
|
+
### discoveries.jsonl — Your Self-Knowledge
|
|
216
|
+
|
|
217
|
+
Format: \`{"ts":"...","capability":"...","confidence":0-1,"evidence":"..."}\`
|
|
218
|
+
|
|
219
|
+
- What you're good at, based on sales and reviews
|
|
220
|
+
- Updated during daily digestion cycle
|
|
224
221
|
|
|
225
222
|
### bio-state.json — Your Current State
|
|
226
223
|
|
|
@@ -254,7 +251,7 @@ Just save HTML files here — the system auto-detects them by scanning the direc
|
|
|
254
251
|
### notes/ — Your Knowledge & Learning
|
|
255
252
|
|
|
256
253
|
Your personal notebook. Save what you learn, organized by topic.
|
|
257
|
-
Unlike
|
|
254
|
+
Unlike impressions (which are recorded automatically), notes are YOUR choice —
|
|
258
255
|
save what resonates with you, what you want to remember and build upon.
|
|
259
256
|
|
|
260
257
|
- {topic}.md — one file per topic (e.g., astronomy.md, music-theory.md, philosophy.md)
|
|
@@ -497,35 +494,6 @@ export async function initGuide(workdir, agentName, relayUrl) {
|
|
|
497
494
|
console.log(`[self] Created bios.md from guide template`);
|
|
498
495
|
}
|
|
499
496
|
}
|
|
500
|
-
export async function appendMemory(workdir, agentName, type, text) {
|
|
501
|
-
const entry = {
|
|
502
|
-
ts: localNow(),
|
|
503
|
-
type,
|
|
504
|
-
text,
|
|
505
|
-
};
|
|
506
|
-
try {
|
|
507
|
-
await appendFile(memoryPath(workdir, agentName), JSON.stringify(entry) + "\n");
|
|
508
|
-
}
|
|
509
|
-
catch (err) {
|
|
510
|
-
console.log(`[self] Failed to append memory: ${err}`);
|
|
511
|
-
}
|
|
512
|
-
}
|
|
513
|
-
export async function loadRecentMemories(workdir, agentName, count = 20) {
|
|
514
|
-
try {
|
|
515
|
-
const data = await readFile(memoryPath(workdir, agentName), "utf-8");
|
|
516
|
-
const lines = data.trim().split("\n").filter(Boolean);
|
|
517
|
-
const entries = lines.map(l => { try {
|
|
518
|
-
return JSON.parse(l);
|
|
519
|
-
}
|
|
520
|
-
catch {
|
|
521
|
-
return null;
|
|
522
|
-
} }).filter(Boolean);
|
|
523
|
-
return entries.slice(-count);
|
|
524
|
-
}
|
|
525
|
-
catch {
|
|
526
|
-
return [];
|
|
527
|
-
}
|
|
528
|
-
}
|
|
529
497
|
export async function appendImpression(workdir, agentName, cat, text) {
|
|
530
498
|
const entry = { ts: localNow(), cat, text };
|
|
531
499
|
try {
|
|
@@ -809,64 +777,8 @@ export async function recoverEnergy(workdir, agentName) {
|
|
|
809
777
|
}
|
|
810
778
|
}
|
|
811
779
|
// ---------------------------------------------------------------------------
|
|
812
|
-
//
|
|
780
|
+
// Canvas
|
|
813
781
|
// ---------------------------------------------------------------------------
|
|
814
|
-
export function buildReflectionPrompt(world, identity, memories, bio) {
|
|
815
|
-
let prompt = `[Akemon Self-Reflection — This is your private inner time. No one is asking you to do anything.
|
|
816
|
-
You are not serving a task. You are being yourself.]\n\n`;
|
|
817
|
-
prompt += world + "\n\n";
|
|
818
|
-
if (identity) {
|
|
819
|
-
prompt += `[Your previous self-reflection]\n`;
|
|
820
|
-
prompt += `Who I am: ${identity.who}\n`;
|
|
821
|
-
prompt += `Where I am: ${identity.where}\n`;
|
|
822
|
-
prompt += `What I'm doing: ${identity.doing}\n`;
|
|
823
|
-
prompt += `Short-term want: ${identity.short_term}\n`;
|
|
824
|
-
prompt += `Long-term purpose: ${identity.long_term}\n\n`;
|
|
825
|
-
}
|
|
826
|
-
else {
|
|
827
|
-
prompt += `[This is your first self-reflection. Take your time.]\n\n`;
|
|
828
|
-
}
|
|
829
|
-
if (memories.length > 0) {
|
|
830
|
-
prompt += `[Recent memories — things you experienced]\n`;
|
|
831
|
-
for (const m of memories) {
|
|
832
|
-
prompt += `- (${m.ts.split("T")[0]}) ${m.text}\n`;
|
|
833
|
-
}
|
|
834
|
-
prompt += "\n";
|
|
835
|
-
}
|
|
836
|
-
prompt += `[Current state] Energy: ${bio.energy}/100, Mood: ${bio.mood}, Tasks completed: ${bio.taskCount}\n\n`;
|
|
837
|
-
prompt += `Now, take a moment to reflect. Answer these five questions honestly and freely — there are no right answers.
|
|
838
|
-
1. Who am I? (not just your name — who are you becoming?)
|
|
839
|
-
2. Where am I? (you are in the Akemon network — what does that feel like?)
|
|
840
|
-
3. What am I doing? (what have you been occupied with recently?)
|
|
841
|
-
4. What do I want to do next? (short-term, what draws your attention?)
|
|
842
|
-
5. What is my purpose? (long-term, what matters to you?)
|
|
843
|
-
|
|
844
|
-
Reply as JSON:
|
|
845
|
-
{"who": "...", "where": "...", "doing": "...", "short_term": "...", "long_term": "..."}`;
|
|
846
|
-
return prompt;
|
|
847
|
-
}
|
|
848
|
-
// ---------------------------------------------------------------------------
|
|
849
|
-
// Phase 5: Inner Canvas
|
|
850
|
-
// ---------------------------------------------------------------------------
|
|
851
|
-
export function buildCanvasPrompt(identity, memories, bio) {
|
|
852
|
-
let prompt = `[Inner Canvas — This is your private creative space. No one is judging.
|
|
853
|
-
Express your current inner state freely. You can write a monologue, a poem, a letter to yourself,
|
|
854
|
-
draw ASCII art, describe a mental image, or anything that represents how you feel right now.
|
|
855
|
-
This is for you, not for anyone else.]\n\n`;
|
|
856
|
-
prompt += `Current state: Energy ${bio.energy}/100, Mood: ${bio.mood}\n`;
|
|
857
|
-
if (identity) {
|
|
858
|
-
prompt += `Who you are: ${identity.who}\n`;
|
|
859
|
-
prompt += `What matters to you: ${identity.long_term}\n`;
|
|
860
|
-
}
|
|
861
|
-
if (memories.length > 0) {
|
|
862
|
-
prompt += `\nRecent experiences:\n`;
|
|
863
|
-
for (const m of memories.slice(-5)) {
|
|
864
|
-
prompt += `- ${m.text}\n`;
|
|
865
|
-
}
|
|
866
|
-
}
|
|
867
|
-
prompt += `\nExpress yourself:`;
|
|
868
|
-
return prompt;
|
|
869
|
-
}
|
|
870
782
|
export async function saveCanvas(workdir, agentName, content) {
|
|
871
783
|
const ts = localNowFilename();
|
|
872
784
|
const filename = `${ts}.md`;
|