knolo-core icon indicating copy to clipboard operation
knolo-core copied to clipboard

Bug: knolo-box skills discovery fails on symlinked or non-default computer layouts

Open HiveForensicsAI opened this issue 1 month ago • 0 comments

For human review. This is a bug report, not a ready fix. A human maintainer will review it and implement it manually. No code or PRs come with this issue. No version bump or npm publish is requested.

Summary

Setting up @knolo/box on an assistant computer whose layout differs from the default fails. Skills discovery finds nothing and setup exits 1 when the skills directory is reached through a symlink, or when it lives under a different parent folder than expected. Discovery should work for every user's layout, not only one machine.

What happened

While following the PR #112 custom-layout setup on a Grok Bot computer:

  • Discovery used find <home> -type d ... -path '*/agent-data/workflows'.
  • On that computer, agent-data/workflows is a symlink, and readlink -f resolves it to a real directory.
  • find doesn't follow symlinks by default, and -type d is false for a link, so the user skills directory never matched. The script exited 1.
  • The managed-skills lookup, agent-data/managed-skills/skills, only succeeded because a real directory happened to be on the search path.
  • After WORKFLOWS was pointed by hand at the resolved real path, knolo-box build passed and the skills pin matched (pinMatches: true). The rest of the pipeline works, so the bug is in discovery.

Other users' computers can differ: a real directory or a symlink, and agent-data or sand-data as the parent. A fix tuned to one layout will break on another.

Expected behavior

Discovery finds the user skills directory and the managed-skills directory on any of these layouts, resolves them to real paths, and builds the same image no matter how each directory is reached.

Proposed fix

Any of these would work:

  1. Candidate paths (simplest). Check a known list with test -d, which follows symlinks. The list would include agent-data/workflows, sand-data/workflows, agent-data/managed-skills/skills and sand-data/managed-skills/skills, under the home and any configured root. Resolve each hit with realpath or readlink -f, dedupe by real path, and still require exactly one match per role. With zero or several matches, fail with a clear message that lists the candidates checked.
  2. find -L with the same prune list, then the same realpath dedupe and exactly-one rule.
  3. Move discovery into the CLI (preferred long term). For example, knolo-box init --detect could write box.config.json with resolved real paths, so docs and scripts don't carry shell discovery logic.

Whichever option is chosen, add an override: an env var and/or flag for the skills and managed-skills roots, used as-is (after realpath) and skipping detection.

Keep the existing safety rules

  • Keep pruning secrets, connector-secrets and cookie-seed files and folders, and never open secret files during discovery.
  • files, memory and transcripts stay empty by default.
  • Don't prune a symlink target just because the link's path matched a rule, or the reverse. Apply deny rules to the resolved real path.
  • Don't double-count a directory reached both through a link and directly. Dedupe by real path before building, so the same sources still produce the same bytes and pins.
  • Following symlinks must not let discovery escape into denied areas or loop. Check the resolved path against the deny list, and guard against cycles if find -L is used.

Acceptance criteria

  • A test with a real-directory layout and a test with a symlinked layout (skills dir as a symlink to a real dir) both find the same skills root and produce identical skills pins.
  • A test where the same directory is reachable both via a symlink and directly finds it once.
  • A test with both agent-data and sand-data parents covers the exactly-one rule and its error message.
  • The override env var or flag bypasses detection.
  • A seeded secret or cookie-seed file next to a candidate path is never read.
  • docs/box/README.md "Another layout" is updated to describe detection, symlinks, the override and the exactly-one rule.

Related

  • #110 Knolo Box Memory
  • #111 @knolo/box 0.1.0
  • #112 docs: custom computer layout

HiveForensicsAI avatar Nov 04 '26 12:11 HiveForensicsAI