gnosys 5.15.1 → 5.15.3

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
@@ -71,8 +71,8 @@ This package installs two binaries:
71
71
  | `gnosys_read` | Read a specific memory. |
72
72
  | `gnosys_search` | Search memories by keyword across all stores. |
73
73
  | `gnosys_list` | List memories across all stores, optionally filtered by category, tag, or store layer. |
74
- | `gnosys_add` | Add a new memory. |
75
- | `gnosys_add_structured` | Add a memory with structured input (no LLM needed). |
74
+ | `gnosys_add_structured` | **Preferred for LLM agents.** Add a memory with structured fields you supply (title, category, tags, content) — makes no server-side LLM call. |
75
+ | `gnosys_add` | Add a memory from raw text; the server's LLM structures it. For non-agent callers (scripts, cron) — agents should use `gnosys_add_structured`. |
76
76
  | `gnosys_tags` | List all tags in the registry, grouped by category. |
77
77
  | `gnosys_tags_add` | Add a new tag to the registry. |
78
78
  | `gnosys_reinforce` | Signal whether a memory was useful. |
package/dist/index.js CHANGED
@@ -624,7 +624,7 @@ regTool("gnosys_list", "List memories across all stores, optionally filtered by
624
624
  }
625
625
  });
626
626
  // ─── Tool: gnosys_add ────────────────────────────────────────────────────
627
- regTool("gnosys_add", "Add a new memory. Accepts raw text — an LLM structures it into an atomic memory. Writes to the project store by default. Use store='personal' for cross-project knowledge, or store='global' to explicitly write to shared org knowledge.", {
627
+ regTool("gnosys_add", "Add a new memory from raw text — the server's LLM structures it into an atomic memory. For non-agent callers (scripts, cron); if you are an LLM agent, use gnosys_add_structured instead to avoid a redundant server-side LLM call. Writes to the project store by default. Use store='personal' for cross-project knowledge, or store='global' to explicitly write to shared org knowledge.", {
628
628
  input: z
629
629
  .string()
630
630
  .describe("Raw text input. Can be a decision, concept, fact, observation, or any knowledge."),
@@ -738,7 +738,7 @@ regTool("gnosys_add", "Add a new memory. Accepts raw text — an LLM structures
738
738
  }
739
739
  });
740
740
  // ─── Tool: gnosys_add_structured ─────────────────────────────────────────
741
- regTool("gnosys_add_structured", "Add a memory with structured input (no LLM needed). Writes to the project store by default. Use store='global' to explicitly write to shared org knowledge.", {
741
+ regTool("gnosys_add_structured", "Preferred for LLM agents: add a memory with structured fields you supply (title, category, tags, content) — makes no server-side LLM call. Writes to the project store by default. Use store='global' to explicitly write to shared org knowledge.", {
742
742
  title: z.string().describe("Memory title"),
743
743
  category: z.string().describe("Category directory name"),
744
744
  tags: z
@@ -35,8 +35,10 @@ export class GnosysEmbeddings {
35
35
  const cacheDir = process.env.GNOSYS_CACHE_DIR ||
36
36
  path.join(process.env.HOME || process.env.USERPROFILE || "/tmp", ".cache", "gnosys");
37
37
  await fs.mkdir(cacheDir, { recursive: true });
38
- // HF_HOME is the canonical env var in @huggingface/transformers v3+;
39
- // keep TRANSFORMERS_CACHE set too for any tooling that still reads it.
38
+ // NOTE: @huggingface/transformers does NOT honor HF_HOME/TRANSFORMERS_CACHE
39
+ // for its Node file cache (that's the Python huggingface_hub convention).
40
+ // It caches under its own `env.cacheDir`, which we set below after import.
41
+ // We still export the env vars for any adjacent tooling that reads them.
40
42
  process.env.HF_HOME = cacheDir;
41
43
  process.env.TRANSFORMERS_CACHE = cacheDir;
42
44
  // Dynamic import — keeps @huggingface/transformers out of the main bundle.
@@ -45,13 +47,22 @@ export class GnosysEmbeddings {
45
47
  // Use `any` here so `tsc` succeeds even when the optional dep is not installed
46
48
  // (CI network-share-simulation job, fresh checkouts, etc.). The real type
47
49
  // is only needed at runtime when the package is present.
48
- let pipeline;
50
+ // `any`: the optional dep may be absent at type-check time (see note above).
51
+ let transformers;
49
52
  try {
50
- ({ pipeline } = await import("@huggingface/transformers"));
53
+ transformers = await import("@huggingface/transformers");
51
54
  }
52
55
  catch {
53
56
  throw new Error("Local embeddings require @huggingface/transformers. Install it with: npm install @huggingface/transformers");
54
57
  }
58
+ // `env.cacheDir` is the actual knob transformers.js uses for its on-disk
59
+ // model cache. Without it the model lands in the package's own
60
+ // node_modules/.cache (wiped on reinstall) and GNOSYS_CACHE_DIR is silently
61
+ // ignored — it does NOT honor HF_HOME/TRANSFORMERS_CACHE. Access by property
62
+ // (not destructuring) so a mocked module without `env` doesn't throw.
63
+ if (transformers.env)
64
+ transformers.env.cacheDir = cacheDir;
65
+ const pipeline = transformers.pipeline;
55
66
  this.pipeline = (await pipeline("feature-extraction", MODEL_NAME, {
56
67
  dtype: "q8",
57
68
  }));
@@ -35,7 +35,8 @@ This project uses **Gnosys** for persistent memory via MCP. Gnosys uses a centra
35
35
 
36
36
  ### Write automatically
37
37
 
38
- - When user says "remember", "memorize", "save this", "note this down", "don't forget" call \`gnosys_add\`
38
+ - **Always write with \`gnosys_add_structured\`** — you are an LLM, so structure the memory yourself (title, category, tags, content, relevance) and pass the explicit fields. Do NOT use the freeform \`gnosys_add\`: it makes the Gnosys server run a *second, redundant* LLM call to structure your text and adds an external provider-key dependency that can fail silently. \`gnosys_add_structured\` makes no server-side model call. (Freeform \`gnosys_add\` exists only for non-agent callers — cron jobs, scripts — that cannot structure text themselves.)
39
+ - When user says "remember", "memorize", "save this", "note this down", "don't forget" — call \`gnosys_add_structured\`
39
40
  - When user states a decision or preference (even casually) — commit to \`decisions\` category
40
41
  - When user provides a spec or plan — commit BEFORE starting work
41
42
  - After significant implementation — commit findings and gotchas
@@ -47,7 +48,7 @@ This project uses **Gnosys** for persistent memory via MCP. Gnosys uses a centra
47
48
  |--------|------|
48
49
  | Find memories | \`gnosys_discover\` (metadata) → \`gnosys_read\` (content) |
49
50
  | Search | \`gnosys_hybrid_search\` (best), \`gnosys_federated_search\` (cross-project), \`gnosys_search\` (keyword), \`gnosys_ask\` (Q&A) |
50
- | Write | \`gnosys_add\` (freeform), \`gnosys_add_structured\` (explicit fields) |
51
+ | Write | \`gnosys_add_structured\` (explicit fields — **always use this as an agent**; no server-side LLM call). \`gnosys_add\` (freeform) is for non-agent callers only. |
51
52
  | Update | \`gnosys_update\`, \`gnosys_reinforce\` (useful/not_relevant/outdated) |
52
53
  | Browse | \`gnosys_list\`, \`gnosys_lens\` (filtered), \`gnosys_tags\`, \`gnosys_graph\` |
53
54
  | Maintain | \`gnosys_maintain\`, \`gnosys_stale\`, \`gnosys_history\`, \`gnosys_dashboard\` |
@@ -63,7 +64,11 @@ This project uses **Gnosys** for persistent memory via MCP. Gnosys uses a centra
63
64
 
64
65
  ### Categories
65
66
 
66
- \`architecture\` · \`decisions\` · \`requirements\` · \`concepts\` · \`roadmap\` · \`landscape\` · \`open-questions\``;
67
+ \`architecture\` · \`decisions\` · \`requirements\` · \`concepts\` · \`roadmap\` · \`landscape\` · \`open-questions\`
68
+
69
+ ### Keeping these instructions current
70
+
71
+ This block is generated by Gnosys and can drift from the installed version. After upgrading Gnosys (or if guidance here looks stale), run \`gnosys sync\` to regenerate this section in every detected IDE rules file (CLAUDE.md, .cursor/rules, .codex). Your user preferences and project conventions are re-injected at the same time.`;
67
72
  }
68
73
  // ─── Content generation ─────────────────────────────────────────────────
69
74
  /**
@@ -30,7 +30,14 @@ export async function runSyncCommand(opts) {
30
30
  process.exitCode = 1;
31
31
  return;
32
32
  }
33
- const resolvedTarget = target || identity.agentRulesTarget || "all";
33
+ // Default to "all": refresh every IDE rules file actually present in the
34
+ // project (detectAllTargets only touches existing files, never creating
35
+ // configs for unused IDEs). A project accumulates multiple IDEs over its
36
+ // life — bare `gnosys sync` must keep all of them current, not just the one
37
+ // recorded in agentRulesTarget at first setup. This matches the upgrade-time
38
+ // "sync registered projects" path, which already uses "all". Use
39
+ // `--target <ide>` to refresh a single file.
40
+ const resolvedTarget = target || "all";
34
41
  const results = await syncToTarget(centralDb, projectDir, resolvedTarget, identity.projectId);
35
42
  if (results.length === 0) {
36
43
  console.error("No targets found. Create a CLAUDE.md, .cursor/, or .codex/ directory first.");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gnosys",
3
- "version": "5.15.1",
3
+ "version": "5.15.3",
4
4
  "description": "Gnosys — Persistent Memory for AI Agents. Sandbox-first runtime, central SQLite brain, federated search, Dream Mode, Web Knowledge Base, Obsidian export.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",