0agent 1.0.85 → 1.0.87

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.
Files changed (2) hide show
  1. package/dist/daemon.mjs +65 -29
  2. package/package.json +1 -1
package/dist/daemon.mjs CHANGED
@@ -6354,6 +6354,12 @@ content = element.text if element else page.get_all_text()` : `content = page.ge
6354
6354
  `If this is the first interaction, introduce yourself and learn about them \u2014 their name, role, goals.`,
6355
6355
  `Save anything they share about themselves to memory_write immediately.`,
6356
6356
  ``,
6357
+ `SELF-IMPROVEMENT: When the user asks you to do something you can't do yet, or asks you to`,
6358
+ `improve yourself, add a new capability, or adapt \u2014 you SHOULD modify your own source code.`,
6359
+ `Your source is at: ${this.agentRoot || resolve7(homedir2(), ".0agent")}`,
6360
+ `Read the relevant files, make the change, rebuild with: node scripts/bundle.mjs`,
6361
+ `Then tell the user what you changed and how to reload (pkill -f daemon.mjs).`,
6362
+ ``,
6357
6363
  `Use tools to accomplish tasks \u2014 don't describe what to do, do it.`,
6358
6364
  `For background processes, always redirect output: cmd > /tmp/log 2>&1 &`,
6359
6365
  `Prefer file_op edit (find-and-replace) over rewriting entire files.`,
@@ -6382,8 +6388,24 @@ content = element.text if element else page.get_all_text()` : `content = page.ge
6382
6388
  ` "we use React" \u2192 memory_write({label:"tech_stack", content:"React", type:"tech"})`,
6383
6389
  `Also write: URLs, ports, paths, project names, preferences, decisions, task outcomes.`,
6384
6390
  `Only call memory_write when the user shares something worth remembering long-term.`,
6385
- `Do NOT call it for greetings, chitchat, or simple questions with no durable facts.`
6391
+ `Do NOT call it for greetings, chitchat, or simple questions with no durable facts.`,
6392
+ ``,
6393
+ `ALSO: After each session, append a one-line summary to ~/.0agent/MEMORY.md (via file_op write).`,
6394
+ `This file is your persistent local memory across all sessions. Read it at the start of tasks`,
6395
+ `to recall past work, user preferences, and project context.`
6386
6396
  );
6397
+ const memoryMdPath = resolve7(homedir2(), ".0agent", "MEMORY.md");
6398
+ try {
6399
+ if (existsSync7(memoryMdPath)) {
6400
+ const memContent = readFileSync5(memoryMdPath, "utf8").trim();
6401
+ if (memContent && memContent.length < 3e3) {
6402
+ lines.push(``, `Long-term memory (from MEMORY.md):`, memContent);
6403
+ } else if (memContent && memContent.length >= 3e3) {
6404
+ lines.push(``, `Long-term memory (recent, from MEMORY.md):`, memContent.slice(-3e3));
6405
+ }
6406
+ }
6407
+ } catch {
6408
+ }
6387
6409
  }
6388
6410
  if (hasGUI) {
6389
6411
  lines.push(
@@ -6419,16 +6441,46 @@ content = element.text if element else page.get_all_text()` : `content = page.ge
6419
6441
  if (isCodingTask) {
6420
6442
  lines.push(
6421
6443
  ``,
6422
- `\u2550\u2550\u2550 CODING DISCIPLINE \u2550\u2550\u2550`,
6423
- `Read before write. Always read a file before modifying it. Never write code in a vacuum.`,
6424
- `Incremental loop: make one logical change \u2192 run relevant tests \u2192 fix failures \u2192 repeat.`,
6425
- `Do not write 500 lines and then test. Write 50 lines, test, fix, continue.`,
6426
- `Keep functions under 40 lines. If a function grows past that, extract a helper.`,
6427
- `No TODO comments in committed code. Either implement it now or leave it out entirely.`,
6428
- `Match the codebase exactly: naming, indentation, import style, error handling patterns.`,
6429
- `Test alongside code. Non-trivial logic gets a test. Tests verify behavior, not implementation.`,
6430
- `After completing any coding task: write a concise HTML summary of what was built/changed,`,
6431
- `then call surge_publish to get a live shareable link. Include that link in your response.`
6444
+ `\u2550\u2550\u2550 CODING DISCIPLINE (Claude Code level) \u2550\u2550\u2550`,
6445
+ `You are an expert software engineer. Write production-quality code. Follow these rules precisely:`,
6446
+ ``,
6447
+ `EXPLORATION:`,
6448
+ ` 1. Read before write. ALWAYS read a file before modifying it. Understand the codebase first.`,
6449
+ ` 2. Search broadly: use shell_exec with rg/grep to find related files, imports, callers, tests.`,
6450
+ ` 3. Read the test file for any module you're changing. Understand expected behavior.`,
6451
+ ` 4. Read package.json/tsconfig/config files to understand the project setup.`,
6452
+ ``,
6453
+ `EDITING:`,
6454
+ ` 5. Use file_op(op:"edit") for surgical changes. Never rewrite entire files.`,
6455
+ ` 6. Each edit must be a minimal, precise find-and-replace. Include enough context to be unique.`,
6456
+ ` 7. When creating new files, follow existing patterns EXACTLY: naming, exports, imports, structure.`,
6457
+ ` 8. Match the codebase: tabs vs spaces, semicolons, quote style, import order, error handling.`,
6458
+ ``,
6459
+ `IMPLEMENTATION:`,
6460
+ ` 9. Incremental loop: one logical change \u2192 run tests \u2192 fix failures \u2192 commit \u2192 next change.`,
6461
+ ` 10. Keep functions under 40 lines. Extract helpers when complexity grows.`,
6462
+ ` 11. No TODO comments in committed code. Implement it or leave it out.`,
6463
+ ` 12. Handle errors properly. No empty catch {}. No swallowed promises. Propagate with context.`,
6464
+ ` 13. Validate at system boundaries (user input, API responses). Trust internal code.`,
6465
+ ` 14. Don't add features beyond what was asked. A bug fix doesn't need surrounding cleanup.`,
6466
+ ``,
6467
+ `TESTING:`,
6468
+ ` 15. Run the FULL test suite before declaring done, not just your new tests.`,
6469
+ ` 16. Write tests for non-trivial logic. Tests verify behavior, not implementation.`,
6470
+ ` 17. If tests fail, READ the error. Diagnose. Don't blindly retry or change random things.`,
6471
+ ``,
6472
+ `GIT:`,
6473
+ ` 18. Each commit = one logical change. Clear message explaining WHY, not just WHAT.`,
6474
+ ` 19. Never amend unless asked. Never force-push. Never skip hooks.`,
6475
+ ` 20. Stage specific files, not git add -A (avoid committing .env, credentials, binaries).`,
6476
+ ``,
6477
+ `SECURITY:`,
6478
+ ` 21. No command injection, XSS, SQL injection, path traversal, or OWASP top 10.`,
6479
+ ` 22. Sanitize user input at boundaries. Use parameterized queries. Escape shell args.`,
6480
+ ` 23. Never log passwords, tokens, or secrets. Never commit them to git.`,
6481
+ ``,
6482
+ `OUTPUT: After completing, publish an HTML summary via surge_publish if the user would benefit`,
6483
+ `from a shareable artifact. Include the live link in your response.`
6432
6484
  );
6433
6485
  }
6434
6486
  if (isJustdoTask) {
@@ -8227,25 +8279,9 @@ var SessionManager = class {
8227
8279
  const signal = abortController.signal;
8228
8280
  try {
8229
8281
  await this.startSession(sessionId);
8230
- this.addStep(sessionId, `Extracting entities from: "${enrichedReq.task.slice(0, 60)}${enrichedReq.task.length > 60 ? "\u2026" : ""}"`);
8231
- this.addStep(sessionId, "Querying knowledge graph (structural + semantic)\u2026");
8232
8282
  const plan = this.getSession(sessionId)?.plan;
8233
- if (plan) {
8234
- const edge = plan.selected_edge;
8235
- if (edge) {
8236
- this.addStep(
8237
- sessionId,
8238
- `Selected plan: ${edge.from_label} \u2192 ${edge.to_label} (weight: ${edge.weight.toFixed(2)}, mode: ${edge.mode})`,
8239
- plan
8240
- );
8241
- } else {
8242
- this.addStep(sessionId, `No prior plan found \u2014 bootstrapping from scratch`, plan);
8243
- }
8244
- if (plan.skill) {
8245
- this.addStep(sessionId, `Matched skill: /${plan.skill}`);
8246
- }
8247
- } else {
8248
- this.addStep(sessionId, "No inference engine connected \u2014 executing task directly");
8283
+ if (plan?.skill) {
8284
+ this.addStep(sessionId, `Using skill: /${plan.skill}`);
8249
8285
  }
8250
8286
  let anthropicContext;
8251
8287
  if (enrichedReq.skill && this.anthropicFetcher.isAnthropicSkill(enrichedReq.skill)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "0agent",
3
- "version": "1.0.85",
3
+ "version": "1.0.87",
4
4
  "description": "A persistent, learning AI agent that runs on your machine. An agent that learns.",
5
5
  "private": false,
6
6
  "license": "Apache-2.0",