Bug: knolo-box skills discovery fails on symlinked or non-default computer layouts
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/workflowsis a symlink, andreadlink -fresolves it to a real directory. finddoesn't follow symlinks by default, and-type dis 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
WORKFLOWSwas pointed by hand at the resolved real path,knolo-box buildpassed 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:
- Candidate paths (simplest). Check a known list with
test -d, which follows symlinks. The list would includeagent-data/workflows,sand-data/workflows,agent-data/managed-skills/skillsandsand-data/managed-skills/skills, under the home and any configured root. Resolve each hit withrealpathorreadlink -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. find -Lwith the same prune list, then the same realpath dedupe and exactly-one rule.- Move discovery into the CLI (preferred long term). For example,
knolo-box init --detectcould writebox.config.jsonwith 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,memoryandtranscriptsstay 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 -Lis 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
skillspins. - A test where the same directory is reachable both via a symlink and directly finds it once.
- A test with both
agent-dataandsand-dataparents 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/box0.1.0 - #112 docs: custom computer layout