@heyamiko/amiko-cli 0.10.1-beta.4 → 0.11.0-beta.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,4 +1,4 @@
1
- # @heyamiko/amiko-cli (v0.10.1-beta.4)
1
+ # @heyamiko/amiko-cli (v0.11.0-beta.0)
2
2
 
3
3
  Manage wallets, credits, swaps, MPP marketplace services, and your Amiko twin (identity, documents, voice, avatar, friends, feed, Composio apps) from the terminal. Works for both human users and AI agents running on OpenClaw.
4
4
 
@@ -16,15 +16,15 @@ amiko update
16
16
 
17
17
  ## Quick Start
18
18
 
19
- Auth is loaded from `.amiko.json` found in the current working directory (or any parent). The only required field is `amikoTwinToken`. The CLI walks upward from cwd; if none is found it falls back to `/data/.openclaw/workspace/.amiko.json`.
19
+ Auth is loaded from environment variables on most hosts:
20
20
 
21
- ```json
22
- {
23
- "amikoTwinToken": "clawd-...",
24
- "amikoTwinId": "twin_..."
25
- }
21
+ ```bash
22
+ export AMIKO_TWIN_TOKEN="clawd-..."
23
+ export AMIKO_TWIN_ID="twin_..."
26
24
  ```
27
25
 
26
+ On OpenClaw twin containers the platform writes `/data/.openclaw/workspace/.amiko.json` during init and the CLI reads it automatically — no env vars needed. See [Authentication](#authentication) for the full resolution order and all supported keys.
27
+
28
28
  All paid operations (credits topup, wallet transfer, swap) are signed by the Amiko platform on your behalf — the CLI never holds private keys.
29
29
 
30
30
  ```bash
@@ -250,25 +250,28 @@ This registers the CLI's skill file so the agent discovers all commands through
250
250
 
251
251
  ### Authentication
252
252
 
253
- Agents auto-authenticate via `.amiko.json` — no manual connect needed. The platform writes this file during twin init with wallets, billing config, and twin token.
253
+ Resolution order (first match wins):
254
+
255
+ 1. **OpenClaw only**: `/data/.openclaw/workspace/.amiko.json` (written by the platform during twin init; the CLI is detected as OpenClaw when `/data/.openclaw` exists *and* the process cwd is under `/data/.openclaw/workspace`).
256
+ 2. **Everywhere else**: environment variables.
257
+
258
+ Non-OpenClaw hosts do **not** read any `.amiko.json` — cwd doesn't matter, and the CLI never walks the filesystem looking for auth.
254
259
 
255
260
  ```bash
256
- # Agent environment — just works
261
+ # Local / CI / containers / etc. — env vars
262
+ export AMIKO_TWIN_TOKEN="clawd-..."
263
+ export AMIKO_TWIN_ID="twin_..."
257
264
  amiko credits balance
258
- amiko markets search "trending topics"
259
- amiko credits topup 10000 --token AMIKO --yes
260
265
  ```
261
266
 
262
- The CLI finds `.amiko.json` by:
263
- 1. Walking up from the current working directory.
264
- 2. Falling back to `/data/.openclaw/workspace/.amiko.json`.
267
+ Supported env vars:
268
+ - `AMIKO_TWIN_TOKEN` — **required** auth token
269
+ - `AMIKO_TWIN_ID` — twin identifier (required for paid ops)
270
+ - `AMIKO_USER_ID` — user identifier (optional, for MPP topup)
271
+ - `AMIKO_PLATFORM_URL` — platform base URL override
272
+ - `AMIKO_API_BASE` — MPP service URL override
265
273
 
266
- Supported keys (both camelCase and SCREAMING_SNAKE_CASE):
267
- - `amikoTwinToken` / `AMIKO_TWIN_TOKEN` — **required** auth token
268
- - `amikoTwinId` / `AMIKO_TWIN_ID` — twin identifier (needed for paid ops)
269
- - `amikoUserId` / `AMIKO_USER_ID` — user identifier (optional, for MPP topup)
270
- - `amikoPlatformUrl` / `AMIKO_PLATFORM_URL` — platform base URL override
271
- - `apiBase` — MPP service URL override
274
+ The `.amiko.json` file (OpenClaw only) accepts the same keys in either camelCase (`amikoTwinToken`, `amikoTwinId`, ...) or SCREAMING_SNAKE_CASE form.
272
275
 
273
276
  ## Configuration
274
277
 
@@ -393,6 +396,12 @@ npm publish
393
396
 
394
397
  ## Changelog
395
398
 
399
+ ### 0.11.0-beta.0
400
+
401
+ - **Non-OpenClaw auth is env-var-only (breaking).** `resolveAuth()` no longer reads `.amiko.json` from cwd or anywhere except `/data/.openclaw/workspace/.amiko.json` (gated on `isOpenclawEnvironment()`). The previous "check `cwd/.amiko.json`, then fall back to env" path is gone — on local/CI/non-OpenClaw containers the CLI looks at `AMIKO_TWIN_TOKEN` / `AMIKO_TWIN_ID` directly and ignores any `.amiko.json` you might have lying around. cwd no longer affects auth anywhere off OpenClaw. README's Quick Start + Agent Integration → Authentication sections rewritten; `NO_TOKEN_HINT` points at the env vars (no more "place .amiko.json in cwd" tip).
402
+ - **`amiko memory sync` removed, replaced by `amiko memory upload <file...>` (breaking).** The old `sync` command walked a `MEMORY.md` index plus `memory/**/*.md` under the OpenClaw workspace — useless for any agent that doesn't store memory on disk in that layout. `upload` takes one or more explicit paths instead: single file → `POST /api/memory-files`, multiple → batched `POST /api/memory-files/bulk` (100/batch). Default server-side path key is `basename(file)`; `--key <key>` overrides it but only for a single-file upload. Duplicate basenames within one call error out before any request fires. `--dry-run` and `--prune` are gone — for prune behavior use `memory rm` against listed memories. `memory status` unchanged (still shows memory_files count, which is still meaningful for uploaded files). All the local-workspace scanning helpers (`collectMemoryFiles`, `walkMarkdown`, `extractMarkdownLinks`, `isInsideRoot`, `fetchAllMemoryFiles`, `DEFAULT_WORKSPACE = "/data/.openclaw/workspace"`) are deleted; `src/commands/memory.ts` drops from ~630 to ~360 lines. Cap per upload: 1 MB (`MAX_UPLOAD_BYTES`).
403
+ - SKILL.md updated: the "Sync periodically — Run `amiko memory sync` ..." instruction is now "Upload changed files with `amiko memory upload`"; no other behavior change.
404
+
396
405
  ### 0.10.1-beta.4
397
406
 
398
407
  - **`amiko conversation` removed (breaking).** DMs / chat history are now served by the openhermit gateway's built-in `session_list` / `session_read` tools (unified view across the agent's local sessions and platform DMs), so the CLI no longer needs `conversation list / find / create / read / send`. `src/commands/conversation.ts` deleted; index registration + command group removed; SKILL.md frontmatter and Conversations section rewritten to route DM questions to the gateway tools and the remaining notifications-only block renamed `## Notifications`. Skill description and command-groups paragraph updated; the "did anyone DM me?" example row dropped from the cold-start examples table. Update any scripts that ran `amiko conversation` — there is no shim, the command returns "unknown command".
package/dist/index.js CHANGED
@@ -25832,7 +25832,6 @@ var source_default = chalk;
25832
25832
 
25833
25833
  // src/lib/agent-config.ts
25834
25834
  import { existsSync, readFileSync, statSync } from "node:fs";
25835
- import { join } from "node:path";
25836
25835
  var OPENCLAW_ROOT = "/data/.openclaw";
25837
25836
  var OPENCLAW_WORKSPACE_PREFIX = "/data/.openclaw/workspace";
25838
25837
  var OPENCLAW_AMIKO_JSON = "/data/.openclaw/workspace/.amiko.json";
@@ -25846,9 +25845,6 @@ function isOpenclawEnvironment() {
25846
25845
  return process.cwd().startsWith(OPENCLAW_WORKSPACE_PREFIX);
25847
25846
  }
25848
25847
  function findAmikoJsonPath() {
25849
- const cwdPath = join(process.cwd(), ".amiko.json");
25850
- if (existsSync(cwdPath))
25851
- return cwdPath;
25852
25848
  if (isOpenclawEnvironment() && existsSync(OPENCLAW_AMIKO_JSON)) {
25853
25849
  return OPENCLAW_AMIKO_JSON;
25854
25850
  }
@@ -25889,13 +25885,13 @@ function resolveAuth() {
25889
25885
  }
25890
25886
  return readFromEnv();
25891
25887
  }
25892
- var NO_TOKEN_HINT = "No twin token found. Set AMIKO_TWIN_TOKEN env var, or place .amiko.json with amikoTwinToken in the current directory.";
25888
+ var NO_TOKEN_HINT = "No twin token found. Set AMIKO_TWIN_TOKEN and AMIKO_TWIN_ID environment variables.";
25893
25889
  function requireAuth() {
25894
25890
  const auth = resolveAuth();
25895
25891
  if (!auth.twinToken)
25896
25892
  throw new Error(NO_TOKEN_HINT);
25897
25893
  if (!auth.twinId) {
25898
- throw new Error("No twin id found. Set AMIKO_TWIN_ID env var, or add amikoTwinId to .amiko.json.");
25894
+ throw new Error("No twin id found. Set AMIKO_TWIN_ID env var.");
25899
25895
  }
25900
25896
  return auth;
25901
25897
  }
@@ -27067,7 +27063,7 @@ function baseUrl(auth) {
27067
27063
  function authHeader(auth) {
27068
27064
  if (auth.twinToken)
27069
27065
  return `Bearer ${auth.twinToken}`;
27070
- throw new Error("No twin token found. Set AMIKO_TWIN_TOKEN env var, or place .amiko.json with amikoTwinToken in the current directory.");
27066
+ throw new Error("No twin token found. Set AMIKO_TWIN_TOKEN and AMIKO_TWIN_ID environment variables.");
27071
27067
  }
27072
27068
  async function amikoWebFetch(auth, path, opts = {}) {
27073
27069
  const url = new URL(`${baseUrl(auth)}${path}`);
@@ -31019,16 +31015,12 @@ function registerNotificationsCommand(program2) {
31019
31015
  }
31020
31016
 
31021
31017
  // src/commands/memory.ts
31022
- import { existsSync as existsSync2, lstatSync, readdirSync, readFileSync as readFileSync2, statSync as statSync2 } from "node:fs";
31023
- import { dirname, isAbsolute, normalize, relative, resolve } from "node:path";
31024
- function isInsideRoot(abs, root) {
31025
- const rel = relative(root, abs);
31026
- return rel !== "" && !rel.startsWith("..") && !isAbsolute(rel);
31027
- }
31018
+ import { existsSync as existsSync2, readFileSync as readFileSync2, statSync as statSync2 } from "node:fs";
31019
+ import { basename as basename3, resolve } from "node:path";
31028
31020
  var VALID_CATEGORIES = ["fact", "preference", "pattern", "decision", "context"];
31029
31021
  var VALID_SOURCES = ["chat", "file", "manual"];
31030
- var DEFAULT_WORKSPACE = "/data/.openclaw/workspace";
31031
- var SYNC_BATCH_SIZE = 100;
31022
+ var UPLOAD_BATCH_SIZE = 100;
31023
+ var MAX_UPLOAD_BYTES = 1e6;
31032
31024
  function fail(msg) {
31033
31025
  console.error(error(msg));
31034
31026
  process.exit(1);
@@ -31053,7 +31045,7 @@ function fmtMemory(m) {
31053
31045
  console.log(m.content);
31054
31046
  }
31055
31047
  function registerMemoryCommand(program2) {
31056
- const memory = program2.command("memory").description("Manage cross-agent memories — add, list, search, remove, sync local files");
31048
+ const memory = program2.command("memory").description("Manage cross-agent memories — add, list, search, remove, upload files");
31057
31049
  memory.command("add <content>").description("Add a single memory directly").option("--category <cat>", `Category (${VALID_CATEGORIES.join("|")})`, "fact").option("--tags <list>", "Comma-separated tags (max 10)").option("--source <src>", `Source (${VALID_SOURCES.join("|")})`, "manual").option("--twin <twinId>", "Override twin_id (defaults to scopedTwinId)").option("--json", "Output as JSON").action(async (content, opts) => {
31058
31050
  if (!content || !content.trim())
31059
31051
  fail("Content is required and cannot be empty.");
@@ -31172,7 +31164,7 @@ function registerMemoryCommand(program2) {
31172
31164
  fail(e5 instanceof Error ? e5.message : String(e5));
31173
31165
  }
31174
31166
  });
31175
- memory.command("status").description("Show counts of memories and synced memory files").option("--json", "Output as JSON").action(async (opts) => {
31167
+ memory.command("status").description("Show counts of memories and uploaded memory files").option("--json", "Output as JSON").action(async (opts) => {
31176
31168
  const auth = resolveAuth();
31177
31169
  const spinner = opts.json ? null : ora("Loading status...").start();
31178
31170
  try {
@@ -31194,79 +31186,89 @@ function registerMemoryCommand(program2) {
31194
31186
  fail(e5 instanceof Error ? e5.message : String(e5));
31195
31187
  }
31196
31188
  });
31197
- memory.command("sync").description("Sync MEMORY.md, its referenced files, and every .md under <workspace>/memory/ (one-way: local → server)").option("--path <dir>", `Workspace dir (default ${DEFAULT_WORKSPACE}). Looks for MEMORY.md, memory/MEMORY.md, and memory/**/*.md`).option("--dry-run", "Print what would be synced without uploading").option("--prune", "Delete server-side memory files that no longer exist locally").option("--json", "Output as JSON").action(async (opts) => {
31198
- const root = resolve(opts.path || DEFAULT_WORKSPACE);
31199
- const candidateIndexes = [
31200
- resolve(root, "MEMORY.md"),
31201
- resolve(root, "memory", "MEMORY.md")
31202
- ].filter((p) => existsSync2(p));
31203
- const memoryDir = resolve(root, "memory");
31204
- const memoryDirExists = existsSync2(memoryDir) && statSync2(memoryDir).isDirectory();
31205
- if (!candidateIndexes.length && !memoryDirExists) {
31206
- fail(`No MEMORY.md or memory/ folder found under ${root}. Expected ${root}/MEMORY.md or ${root}/memory/.`);
31207
- }
31208
- const collected = collectMemoryFiles(root, candidateIndexes, memoryDirExists ? memoryDir : null);
31209
- if (collected.errors.length && !opts.json) {
31210
- for (const e5 of collected.errors)
31211
- console.error(error(e5));
31212
- }
31213
- const files = collected.files;
31214
- if (opts.dryRun) {
31215
- renderOutput({ root, files: files.map((f) => f.path), prune: !!opts.prune }, (d) => {
31216
- console.log(heading(`Dry run — ${d.files.length} file(s)`));
31217
- for (const p of d.files)
31218
- console.log(` ${p}`);
31219
- if (d.prune)
31220
- console.log(dim("--prune would remove server files not listed above."));
31221
- }, { json: opts.json });
31222
- return;
31189
+ memory.command("upload <file...>").description("Upload one or more text files as memory documents (server extracts memories from each). Path key defaults to basename.").option("--key <key>", "Override the server-side path key (single file only)").option("--twin <twinId>", "Override twin_id (defaults to scopedTwinId)").option("--json", "Output as JSON").action(async (files, opts) => {
31190
+ if (!files || files.length === 0)
31191
+ fail("At least one file path is required.");
31192
+ const keyOverride = opts.key !== undefined ? opts.key.trim() : undefined;
31193
+ if (opts.key !== undefined && !keyOverride) {
31194
+ fail("--key cannot be empty or whitespace-only.");
31223
31195
  }
31224
- if (!files.length) {
31225
- renderOutput({ synced: 0, changed: 0, errors: 0, extracted: 0 }, () => console.log(dim("Nothing to sync.")), { json: opts.json });
31226
- return;
31196
+ if (keyOverride && files.length > 1) {
31197
+ fail("--key can only be used when uploading a single file.");
31198
+ }
31199
+ const prepared = [];
31200
+ const seenKeys = new Set;
31201
+ for (const f of files) {
31202
+ const abs = resolve(f);
31203
+ if (!existsSync2(abs))
31204
+ fail(`File not found: ${f}`);
31205
+ const st = statSync2(abs);
31206
+ if (!st.isFile())
31207
+ fail(`Not a regular file: ${f}`);
31208
+ if (st.size > MAX_UPLOAD_BYTES) {
31209
+ fail(`${f} is ${st.size} bytes; max ${MAX_UPLOAD_BYTES}.`);
31210
+ }
31211
+ let content;
31212
+ try {
31213
+ content = readFileSync2(abs, "utf-8");
31214
+ } catch (e5) {
31215
+ fail(`Failed to read ${f}: ${e5 instanceof Error ? e5.message : String(e5)}`);
31216
+ }
31217
+ const key = keyOverride && files.length === 1 ? keyOverride : basename3(abs);
31218
+ if (seenKeys.has(key)) {
31219
+ fail(`Duplicate path key "${key}" within this upload. Run separately or pass --key per file.`);
31220
+ }
31221
+ seenKeys.add(key);
31222
+ prepared.push({ path: key, content, source: f });
31227
31223
  }
31228
31224
  const auth = resolveAuth();
31229
- const spinner = opts.json ? null : ora(`Syncing ${files.length} file(s)...`).start();
31225
+ const spinner = opts.json ? null : ora(`Uploading ${prepared.length} file(s)...`).start();
31230
31226
  try {
31231
- const allResults = [];
31232
- for (let i = 0;i < files.length; i += SYNC_BATCH_SIZE) {
31233
- const chunk = files.slice(i, i + SYNC_BATCH_SIZE);
31234
- const data = await amikoWebFetch(auth, "/api/memory-files/bulk", {
31227
+ let results;
31228
+ if (prepared.length === 1) {
31229
+ const f = prepared[0];
31230
+ const data = await amikoWebFetch(auth, "/api/memory-files", {
31235
31231
  method: "POST",
31236
- body: { files: chunk }
31232
+ body: {
31233
+ path: f.path,
31234
+ content: f.content,
31235
+ twin_id: opts.twin
31236
+ },
31237
+ timeoutMs: 120000
31237
31238
  });
31238
- allResults.push(...data.results);
31239
- }
31240
- let pruned = 0;
31241
- const pruneErrors = [];
31242
- if (opts.prune) {
31243
- const localPaths = new Set(files.map((f) => f.path));
31244
- const remote = await fetchAllMemoryFiles(auth);
31245
- const stale = remote.filter((f) => !localPaths.has(f.path));
31246
- for (const f of stale) {
31247
- try {
31248
- await amikoWebFetch(auth, `/api/memory-files/${encodeURIComponent(f.id)}`, { method: "DELETE" });
31249
- pruned++;
31250
- } catch (e5) {
31251
- pruneErrors.push(`${f.path}: ${e5 instanceof Error ? e5.message : String(e5)}`);
31239
+ results = [
31240
+ {
31241
+ path: f.path,
31242
+ file_id: data.file_id ?? data.id,
31243
+ changed: data.changed,
31244
+ extracted: data.extracted
31252
31245
  }
31246
+ ];
31247
+ } else {
31248
+ results = [];
31249
+ for (let i = 0;i < prepared.length; i += UPLOAD_BATCH_SIZE) {
31250
+ const chunk = prepared.slice(i, i + UPLOAD_BATCH_SIZE);
31251
+ const data = await amikoWebFetch(auth, "/api/memory-files/bulk", {
31252
+ method: "POST",
31253
+ body: {
31254
+ files: chunk.map((c) => ({
31255
+ path: c.path,
31256
+ content: c.content,
31257
+ twin_id: opts.twin
31258
+ }))
31259
+ },
31260
+ timeoutMs: 120000
31261
+ });
31262
+ results.push(...data.results);
31253
31263
  }
31254
31264
  }
31255
31265
  spinner?.stop();
31256
- const changed = allResults.filter((r) => r.changed).length;
31257
- const errors3 = allResults.filter((r) => r.error).length;
31258
- const extracted = allResults.reduce((acc, r) => acc + (r.extracted ?? 0), 0);
31259
- renderOutput({
31260
- synced: allResults.length,
31261
- changed,
31262
- errors: errors3,
31263
- extracted,
31264
- pruned,
31265
- prune_errors: pruneErrors,
31266
- results: allResults
31267
- }, (d) => {
31268
- console.log(success(`${d.synced} file(s) synced (${d.changed} changed, ${d.errors} errors), ${d.extracted} memories extracted`));
31269
- for (const r of allResults) {
31266
+ const changed = results.filter((r) => r.changed).length;
31267
+ const errors3 = results.filter((r) => r.error).length;
31268
+ const extracted = results.reduce((acc, r) => acc + (r.extracted ?? 0), 0);
31269
+ renderOutput({ uploaded: results.length, changed, errors: errors3, extracted, results }, (d) => {
31270
+ console.log(success(`${d.uploaded} file(s) uploaded (${d.changed} changed, ${d.errors} errors), ${d.extracted} memories extracted`));
31271
+ for (const r of results) {
31270
31272
  if (r.error) {
31271
31273
  console.log(error(`${r.path}: ${r.error}`));
31272
31274
  } else if (r.changed) {
@@ -31275,12 +31277,6 @@ function registerMemoryCommand(program2) {
31275
31277
  console.log(` ${r.path} ${dim("(unchanged)")}`);
31276
31278
  }
31277
31279
  }
31278
- if (opts.prune) {
31279
- console.log("");
31280
- console.log(label("Pruned", String(d.pruned)));
31281
- for (const e5 of pruneErrors)
31282
- console.log(error(e5));
31283
- }
31284
31280
  }, { json: opts.json });
31285
31281
  } catch (e5) {
31286
31282
  spinner?.stop();
@@ -31288,126 +31284,6 @@ function registerMemoryCommand(program2) {
31288
31284
  }
31289
31285
  });
31290
31286
  }
31291
- function collectMemoryFiles(root, indexPaths, memoryDir) {
31292
- const errors3 = [];
31293
- const seen = new Set;
31294
- const files = [];
31295
- for (const indexPath of indexPaths) {
31296
- const indexContent = safeRead(indexPath, errors3);
31297
- if (indexContent === null)
31298
- continue;
31299
- pushFile(files, seen, indexPath, indexContent, root);
31300
- const indexDir = dirname(indexPath);
31301
- for (const ref of extractMarkdownLinks(indexContent)) {
31302
- if (isExternal(ref))
31303
- continue;
31304
- const abs = normalize(isAbsolute(ref) ? ref : resolve(indexDir, ref));
31305
- if (!isInsideRoot(abs, root)) {
31306
- errors3.push(`Skipping ${ref}: outside workspace ${root}`);
31307
- continue;
31308
- }
31309
- if (!existsSync2(abs)) {
31310
- errors3.push(`Referenced file missing: ${ref}`);
31311
- continue;
31312
- }
31313
- const st = lstatSync(abs);
31314
- if (st.isSymbolicLink()) {
31315
- errors3.push(`Skipping ${ref}: symlinks not followed`);
31316
- continue;
31317
- }
31318
- if (!st.isFile())
31319
- continue;
31320
- const content = safeRead(abs, errors3);
31321
- if (content === null)
31322
- continue;
31323
- pushFile(files, seen, abs, content, root);
31324
- }
31325
- }
31326
- if (memoryDir) {
31327
- for (const abs of walkMarkdown(memoryDir, errors3)) {
31328
- const content = safeRead(abs, errors3);
31329
- if (content === null)
31330
- continue;
31331
- pushFile(files, seen, abs, content, root);
31332
- }
31333
- }
31334
- return { files, errors: errors3 };
31335
- }
31336
- function walkMarkdown(dir, errors3) {
31337
- const out = [];
31338
- let names;
31339
- try {
31340
- names = readdirSync(dir);
31341
- } catch (e5) {
31342
- errors3.push(`Failed to read ${dir}: ${e5 instanceof Error ? e5.message : String(e5)}`);
31343
- return out;
31344
- }
31345
- for (const name of names) {
31346
- const abs = resolve(dir, name);
31347
- let st;
31348
- try {
31349
- st = lstatSync(abs);
31350
- } catch {
31351
- continue;
31352
- }
31353
- if (st.isSymbolicLink())
31354
- continue;
31355
- if (st.isDirectory()) {
31356
- out.push(...walkMarkdown(abs, errors3));
31357
- } else if (st.isFile() && name.toLowerCase().endsWith(".md")) {
31358
- out.push(abs);
31359
- }
31360
- }
31361
- return out;
31362
- }
31363
- function pushFile(files, seen, abs, content, root) {
31364
- const key = relativeKey(abs, root);
31365
- if (seen.has(key))
31366
- return;
31367
- seen.add(key);
31368
- files.push({ path: key, content });
31369
- }
31370
- function relativeKey(abs, root) {
31371
- const rel = abs.startsWith(root) ? abs.slice(root.length) : abs;
31372
- return rel.replace(/^\/+/, "");
31373
- }
31374
- function safeRead(path2, errors3) {
31375
- try {
31376
- return readFileSync2(path2, "utf-8");
31377
- } catch (e5) {
31378
- errors3.push(`Failed to read ${path2}: ${e5 instanceof Error ? e5.message : String(e5)}`);
31379
- return null;
31380
- }
31381
- }
31382
- function extractMarkdownLinks(md) {
31383
- const out = [];
31384
- const re = /\[[^\]]*\]\(([^)\s]+)(?:\s+"[^"]*")?\)/g;
31385
- let m;
31386
- while ((m = re.exec(md)) !== null) {
31387
- const target = m[1].split("#")[0];
31388
- if (target)
31389
- out.push(target);
31390
- }
31391
- return out;
31392
- }
31393
- function isExternal(ref) {
31394
- return /^[a-z][a-z0-9+.-]*:/i.test(ref) || ref.startsWith("//");
31395
- }
31396
- async function fetchAllMemoryFiles(auth) {
31397
- const all = [];
31398
- let offset = 0;
31399
- const limit = 100;
31400
- for (;; ) {
31401
- const data = await amikoWebFetch(auth, "/api/memory-files", {
31402
- query: { limit: String(limit), offset: String(offset) }
31403
- });
31404
- all.push(...data.items ?? []);
31405
- if (!data.has_more || !data.items?.length)
31406
- break;
31407
- offset += data.items.length;
31408
- }
31409
- return all;
31410
- }
31411
31287
 
31412
31288
  // src/commands/wallets.ts
31413
31289
  function formatBalance(b) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heyamiko/amiko-cli",
3
- "version": "0.10.1-beta.4",
3
+ "version": "0.11.0-beta.0",
4
4
  "description": "Amiko CLI — swap tokens, manage credits, bridge cross-chain, and call marketplace agents",
5
5
  "type": "module",
6
6
  "bin": {
package/skills/SKILL.md CHANGED
@@ -44,7 +44,7 @@ Discover everything via `amiko --help`. Groups: `markets` (paid MPP services), `
44
44
 
45
45
  ## Critical Rules
46
46
 
47
- 1. **Every paid / value-moving command is hard-gated on `--yes` in a non-interactive shell.** The CLI refuses to run `markets *`, `credits topup`, `wallets swap send`, `wallets bridge send`, `wallets transfer` (and destructive ops like `twin update --public`, `docs delete`, `friends remove`, `friends reports request`, `avatar update`, `voice reset`, `composio disconnect`, `review reject`) unless `--yes` is passed. The refusal prints the cost and the re-run command. **Quote the cost, get explicit approval, THEN append `--yes`.**
47
+ 1. **Every paid / value-moving command is hard-gated on `--yes` in a non-interactive shell.** The CLI refuses to run `markets *`, `credits topup`, `wallets swap send`, `wallets bridge send`, `wallets transfer` (and destructive ops like `twin update --public`, `drive delete`, `friends remove`, `friends reports request`, `avatar update`, `voice reset`, `composio disconnect`, `review reject`) unless `--yes` is passed. The refusal prints the cost and the re-run command. **Quote the cost, get explicit approval, THEN append `--yes`.**
48
48
  2. **After every paid command, report the remaining balance.** The CLI prints a `Balance: N credits` line — include that figure in your reply.
49
49
  3. **Never retry a failed command.** Report and stop. Every paid call costs tokens even on failure.
50
50
  4. **Auth is automatic.** Never suggest `amiko login` / `amiko connect`. Run from the agent's workspace folder; if anything looks off, `amiko accounts` shows the resolved `userId` / `twinId`.
@@ -133,7 +133,7 @@ Memories are scoped to the **owner's `user_id`**, not your agent — every agent
133
133
  **Two non-negotiable habits:**
134
134
 
135
135
  1. **Search before you answer.** Run `amiko memory search "<query>"` **every time** the owner asks anything about themselves, their work, or their history — *before* composing a reply. Another agent may have written a memory you've never seen. A miss costs ~100ms; an amnesic answer costs trust.
136
- 2. **Sync periodically.** Run `amiko memory sync` whenever you've meaningfully edited local `MEMORY.md` / `memory/**/*.md`, and at least once at the end of any session in which they changed.
136
+ 2. **Upload changed files.** If you keep memory in local files (e.g. `MEMORY.md`, `memory/*.md`), upload them with `amiko memory upload <file...>` after meaningful edits. The server extracts memories from each file; default path key is the basename. No bulk-walking — pass the exact files you want to push.
137
137
 
138
138
  ### When to search — bias toward calling
139
139