Skip to content

archivist: vault search fails from a worktree (trunk-resolution missing) #59

@SnowboardTechie

Description

@SnowboardTechie

Problem / Motivation

Every @archivist invocation from a git worktree returns "vault not accessible / vault structure could not be resolved" — even when .notes/ exists in the trunk and contains active content. The agent appears to look for .notes/ relative to its CWD instead of resolving the trunk root first.

Surfaced during PR #57 (issue-work flow for #14). Six parallel @archivist calls during /pr-self-review Phase 1.2 — invoked from the worktree at .claude/worktrees/charming-franklin-bc756a/ — all returned variants of:

The .notes/ directory is not accessible from the current worktree context.
The vault structure could not be resolved from the current working directory.
Unable to enumerate vault.

Concurrently, ls /Users/bryan/code/athena-notes/.notes/ showed active content (brand note, decisions/, explorations/, .agents/). The trunk symlink resolves correctly via git rev-parse --git-common-dir; archivist isn't using that pattern.

The agent-workspace skill explicitly claims worktree-aware trunk resolution is "standard for Athena Notes agents." The archivist agent doesn't appear to honor that contract.

Impact: silent false negatives across every Athena flow that invokes archivist from a worktree — /pr-self-review Phase 1.2, /session-review Step 2, /issue-work related-notes fetch, /meeting-sync prior-art search. Each of these spawns parallel archivist calls expecting cached prior-art context; from a worktree they return empty. /pr-self-review writes related-notes.json: [] and proceeds — degrades gracefully but loses the related-notes context the cache exists for. /session-review's pre-draft prior-art check is similarly blind.

Proposed behavior

@archivist resolves the trunk root before searching .notes/, using the same worktree-aware pattern documented in agent-workspace/SKILL.md (resolve_trunk_root — checks whether $(git rev-parse --show-toplevel)/.git is a regular file, and if so returns dirname $(git rev-parse --git-common-dir)).

After the fix, an archivist call from any worktree finds and searches the same .notes/ the trunk would.

Scope

In scope

  • Update plugins/athena-notes/agents/archivist.md to follow the agent-workspace trunk-resolution pattern before any .notes/ read.
  • Add a one-line smoke test or invocation example showing the pattern, so future agent edits don't regress.

Out of scope

  • Auditing every other agent for the same bug (file separately if a sweep finds more — sage, scribe, pyre likely also need to read from the trunk, but each is its own scope).
  • Refactoring the agent-workspace skill body or the resolve_trunk_root definition itself — the pattern works; archivist just isn't using it.
  • Adding a CI check that enforces trunk-resolution presence in every agent (would be nice; deferred).

Implementation hints

  • Mechanism: archivist's prompt body should explicitly invoke trunk resolution at the top, before any Glob/Read against .notes/. The pattern from agent-workspace/SKILL.md is the canonical form.
  • Verification path: spawn archivist from a worktree (any /pr-self-review-style invocation reproduces it) and confirm it returns matches when .notes/ has content. Easier path: invoke @archivist directly from a fresh worktree with a known-existing query topic and check the response.
  • Adjacent context: PR #57's ~/.claude/issue-work/SnowboardTechie-athena-notes-14/ state-dir captured the six failing archivist responses if a reference is useful.

Acceptance criteria

  • @archivist invoked from a worktree successfully reads .notes/ content from the trunk.
  • At least one existing skill-invocation path (e.g., /pr-self-review Phase 1.2 from a worktree) returns non-empty related-notes.json when .notes/ has matching content.
  • archivist.md references the agent-workspace trunk-resolution pattern explicitly so the contract is visible at agent-body level.

Open questions

  • Should this same fix sweep through every other agent that reads .notes/ (scribe, sage, pyre), or stay narrowly archivist-only and let a follow-up issue cover the audit?
  • Is there a lighter alternative — e.g., having the orchestrator (skill caller) pass TRUNK_ROOT into the archivist prompt — that avoids each agent re-running the resolution? (Trade-off: agent autonomy vs. contract surface.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingquick winSmall, self-contained scope — good candidate for a focused session

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions