Audit share

From mikeprasad/aria-knowledge · View interactive version

Audit share is an AI agent skill from the GitHub repository mikeprasad/aria-knowledge. Review personal ARIA knowledge for promotion to team-shared _project-knowledge folders. Trigger on /audit-share, /share-audit, share knowledge, promote to team, or sync shared knowledge.

How to use this skill

Skill file

/audit share — Batch-Review Personal Knowledge for Team Sharing

Canonical invocation: /audit share. The direct /audit-share form is retained for compatibility and is not advertised.

Walk personal knowledge files and IDEAS-BACKLOG.md entries; recommend a target _project-knowledge/ destination per item; present a batch summary; let the user approve, modify, or skip.

Step 0: Resolve Config

Read ~/.claude/aria-knowledge.local.md and extract:

If the config file doesn't exist: "aria-knowledge is not configured. Run /setup to get started."

If projects_shared_knowledge is empty/missing (or the legacy literal true): "Shared knowledge has no projects enabled. Run /setup and pick which projects to enable in the 'Which projects do you want to enable shared knowledge for?' prompt."

If projects_enabled: false or projects_list empty: "Shared knowledge requires the project tier. Run /setup to enable projects and configure your project list."

If author_tag is missing AND no derivable git user.name: "Author tag is required. Set author_tag in ~/.claude/aria-knowledge.local.md (e.g., init) or configure git config user.name."

Step 1: Scan Candidates

Walk these directories under {knowledge_folder}/:

Plus IDEAS-BACKLOG.md entries from each project root:

Skip candidates when:

Step 2: Suggest Action Per Candidate

For each candidate, determine:

  1. Project tag(s) — derived from any of three sources, unioned (matches /index Phase 4 Decision #9 path-derived convention so audit-share and /index see the same tag set):
  1. Recommended action (per recommendation produced in step 1):
  1. Target path — compute as follows. Multi-repo projects (those with a projects_groups entry) require sub-repo selection because the projects_list path resolves to a container, not a git repo:
  1. IDEAS-BACKLOG.md entries are special-cased: each entry promotes by appending to the project's IDEAS-BACKLOG.md, not by creating a new file. Path resolution mirrors step 3's single-vs-multi-repo logic — single-repo: <project-root>/_project-knowledge/IDEAS-BACKLOG.md; multi-repo: <project-root>/<primary-sub-repo>/_project-knowledge/IDEAS-BACKLOG.md (always primary, since IDEAS-BACKLOG entries are project-wide queue items not per-role). Cross-cutting ideas append to cross/IDEAS-BACKLOG.md instead.
  2. Public-repo flag — for each unique target sub-repo (not container), run gh repo view --json visibility 2>/dev/null (cache result for the session). If visibility is PUBLIC, mark target as needing sanitization warn-prompt at execute time. If gh is unavailable, skip the check (do not block); note in summary as "could not verify repo visibility."

Step 3: Present Batch Summary

Group recommendations by action; number continuously across groups; flag public-repo targets:

audit-share — found N candidates not yet in shared knowledge

## Recommended: share to repo (X)
1. knowledge/insights/foo.md (project: proj-a)
   → ~/Projects/<path>/_project-knowledge/2026-04-28-init-foo.md
2. knowledge/decisions/008-bar.md (project: proj-a)
   → ~/Projects/<path>/_project-knowledge/2026-04-28-init-bar.md
   ⚠️ public repo — content-safety prompt at execute time
3. ...

## Recommended: share to cross (Y)
9. knowledge/approaches/api.md (project: cross)
   → ⚠️ pick destination repo at execute time
10. ...

## Recommended: skip (Z)
12. knowledge/feedback/baz.md — feedback type, not in scope
13. knowledge/insights/qux.md — no project tag, no destination
...

⚠️ T of these target public repos: <repo-1>, <repo-2>

Decide:
  all                 — execute all recommended actions
  numbers (1 3 5)     — execute only specified items
  modify N            — change action / destination / slug for item N
  skip                — cancel without executing

Section omission: omit a heading entirely if its count is zero. If no candidates at all, skip Steps 4-7 and report: "No candidates to share — all eligible knowledge is already shared or out of scope."

Step 4: User Decision

Wait for user input. Parse:

Step 5: Execute Approved Actions

For each approved item, execute in order:

  1. Resolve cross destination (only if action is share-to-cross and destination not yet set): prompt "Pick destination repo for cross item: <list of projects_shared_knowledge entries>". For multi-repo projects, the cross destination further resolves to that project's primary sub-repo's _project-knowledge/cross/ folder (not the container). Update target path accordingly.
  2. Sanitization warn-prompt (only if target repo is public):

```

⚠️ Target repo "<repo-name>" is PUBLIC.

Source file: <personal-path>

Confirm content has no secrets / internal URLs / personal names? [yes / no / show-file]

```

  1. Read source file — full content with frontmatter.
  2. Build team copy:
  1. Write team copy at target path (Step 2's computed path). For IDEAS-BACKLOG.md entries, append the section to the target file rather than creating a new file.
  2. Update personal copy frontmatter — add an entry to the shared: array:

```yaml

shared:

date: 2026-04-28

```

If the array doesn't exist, create it. If it exists, append (don't overwrite — supports re-sharing to multiple repos over time).

  1. Auto-create README.md if this is the first write to this _project-knowledge/ folder (folder was empty or didn't exist before). Use the template from Step 6 below.
  2. git add the new/changed files. The git operation must run inside the destination sub-repo's working tree (<sub-repo-root> for multi-repo projects, <project-root> for single-repo) — running git add from a non-repo container directory silently no-ops. Use git -C <sub-repo-root> add <relative-path> to make the working-tree explicit. Do NOT commit — user reviews and commits via normal flow.

Step 6: README Template (Auto-Created on First Write)

When the first file is written to a repo's _project-knowledge/ folder, create README.md alongside it with this content:

# _project-knowledge/

This folder holds team-shared project knowledge promoted from individual developers' personal knowledge captures.

**Convention:**
- Files use `{YYYY-MM-DD}-{author-tag}-{slug}.md` naming (e.g., `2026-04-28-init-foo.md`).
- Each file's frontmatter includes `origin:` (where it came from), `shared_by:` (who promoted it), and `shared_at:` (when).
- The `cross/` subfolder holds cross-cutting knowledge that applies across multiple repos in the same product group.
- `IDEAS-BACKLOG.md` is a queue of unscheduled future work — entries are dated sections.

**Tooling (optional):**
- These files are plain markdown — readable and editable without any tool.
- The ARIA Claude Code plugin (https://github.com/mikeprasad/aria-knowledge) provides:
  - `/audit share` to promote personal knowledge here
  - `/index` + `/context` to discover and load these files into Claude sessions
- Non-ARIA teammates can read and write directly; no tool dependency.

**Contributing:**
- Edit personal knowledge in your own knowledge store, then promote via `/audit share` (or copy manually).
- Direct edits to files in this folder are fine; commit through normal PR review.

Step 6.5: CLAUDE.md Reference Offer (First-Write Hook, Per Repo)

The first time audit-share writes to a repo's _project-knowledge/ folder (same trigger as Step 6's README auto-create), offer to add a _project-knowledge/ reference to that repo's CLAUDE.md so non-ARIA teammates can discover the convention. This used to be a setup-time batch prompt; it was deferred here so the documentation appears alongside the first real share rather than as an aspirational forward reference.

Per-repo, gated by these conditions in order:

  1. Probe for <repo-root>/CLAUDE.md. If absent, skip silently (don't auto-create).
  2. Probe for an existing ## Team-Shared Knowledge heading inside the CLAUDE.md (or a previous reference to _project-knowledge/). If present, skip silently (already documented; don't append again on re-shares).
  3. Detect git tracking via git -C <repo-root> ls-files --error-unmatch CLAUDE.md (exit 0 = tracked, non-zero = untracked or no git). Cache result for the session.
  4. Detect remote visibility if tracked: gh repo view --json visibility 2>/dev/null (cache per repo for the session). If gh is unavailable, treat as "unknown remote."

Prompt user with the appropriate warning tier:

| Tracking state | Prompt form |

|----------------|-------------|

| Untracked or no git | Add a _project-knowledge/ reference to <repo-root>/CLAUDE.md? This is a 5-line section explaining the convention to teammates not using ARIA. (y/N) |

| Tracked, public remote | ⚠️ <repo-root>/CLAUDE.md is committed to a PUBLIC remote — this edit will be visible to anyone on push. Add a _project-knowledge/ reference? (y/N) |

| Tracked, private remote | <repo-root>/CLAUDE.md is committed to a remote — teammates will see this edit on next push. Add a _project-knowledge/ reference? (y/N) |

| Tracked, unknown remote (gh missing or repo not on GitHub) | <repo-root>/CLAUDE.md is git-tracked — committing this edit will broadcast it to anyone with the remote. Add a _project-knowledge/ reference? (y/N) |

Default is N for all four tiers. Per-repo confirmation matches the cadence of /setup's file-diff prompts.

On y: append the following block to <repo-root>/CLAUDE.md (insert after the title H1 if one exists, otherwise append at end). git add the change but do NOT commit.

## Team-Shared Knowledge

Team-shared knowledge for this repo lives in `_project-knowledge/` (committed). Files follow `{YYYY-MM-DD}-{author}-{slug}.md` naming with frontmatter origin pointers. Cross-cutting items live in `_project-knowledge/cross/`. See `_project-knowledge/README.md` for the convention.

On N or empty input: skip; record the decision in the Step 8 report ("CLAUDE.md reference declined for <repo-root>"). User can add manually later or accept on a future first-write to a different repo.

Idempotency: the existing-heading probe in step 2 above prevents duplicate sections if the user accepts on a first share, then later runs audit-share again with new content into the same repo. The "first-write hook" trigger only fires when _project-knowledge/ is newly created OR when CLAUDE.md still lacks the reference.

Step 6.5b: Container CLAUDE.md Offer (Multi-Repo Group Awareness)

Single-repo projects are fully covered by Step 6.5a above — <repo-root>/CLAUDE.md is the only relevant CLAUDE.md, and the canned single-repo text accurately describes that repo's _project-knowledge/ folder.

Multi-repo projects (those with a projects_groups entry) have a second CLAUDE.md worth pointing at: the container that holds the sub-repos. Teammates navigating at the container level (above any one sub-repo) benefit from a group-level pointer that names each sub-repo's _project-knowledge/. The single-repo canned text is structurally wrong for the container — the container has no _project-knowledge/ of its own — so this step uses a different text variant.

Run this step after Step 6.5a, gated by these conditions in order:

  1. Detect group membership. Parse the projects_groups block from ~/.claude/aria-knowledge.local.md. For each group tag, walk the role-value pairs (e.g., backend:, web:, mobile:, plus any custom roles); if any role-value resolves to a path equal to the current sub-repo's path, the current sub-repo belongs to that group tag. Record the group tag. If no match, skip Step 6.5b entirely (pure single-repo case).
  2. Resolve container path. Look up the matched group tag in projects_list to get the container's relative path; the container root is ~/Projects/<that-path>.
  3. Session cache check. If this group tag has already had its container offer made (or skipped) earlier in the current audit-share invocation — e.g., user shared to one sub-repo, then later to a sibling sub-repo in the same group — skip silently. The cache prevents re-prompting across sibling shares within one run.
  4. Probe <container-root>/CLAUDE.md. If absent, skip silently (don't auto-create) and record group as "container CLAUDE.md absent" in the session cache.
  5. Idempotency probe. Search the container CLAUDE.md for an existing ## Team-Shared Knowledge heading OR any reference to _project-knowledge/. If present, skip silently and record group in the session cache as "container CLAUDE.md already has reference."
  6. Detect git tracking for the container CLAUDE.md via git -C <container-root> ls-files --error-unmatch CLAUDE.md. Cache result.
  7. Detect remote visibility if tracked: gh repo view --json visibility 2>/dev/null (cache per container for the session). If gh is unavailable, treat as "unknown remote."

Prompt user with the appropriate warning tier (same three-tier shape as Step 6.5a, retargeted at the container path):

| Tracking state | Prompt form |

|----------------|-------------|

| Untracked or no git | Add a group-level _project-knowledge/ reference to <container-root>/CLAUDE.md? This points teammates at each sub-repo's _project-knowledge/ folder. (y/N) |

| Tracked, public remote | ⚠️ <container-root>/CLAUDE.md is committed to a PUBLIC remote — this edit will be visible to anyone on push. Add a group-level _project-knowledge/ reference? (y/N) |

| Tracked, private remote | <container-root>/CLAUDE.md is committed to a remote — teammates will see this edit on next push. Add a group-level _project-knowledge/ reference? (y/N) |

| Tracked, unknown remote | <container-root>/CLAUDE.md is git-tracked — committing this edit will broadcast it to anyone with the remote. Add a group-level _project-knowledge/ reference? (y/N) |

Default is N for all four tiers, matching Step 6.5a's posture.

On y: append the group-aware variant to <container-root>/CLAUDE.md (insert after the title H1 if one exists, otherwise append at end). git add the change but do NOT commit. Variant text:

## Team-Shared Knowledge

Team-shared knowledge for repos in this group lives in each sub-repo's `_project-knowledge/` folder (committed per repo: `{sub1}/_project-knowledge/`, `{sub2}/_project-knowledge/`, ...). Files follow `{YYYY-MM-DD}-{author}-{slug}.md` naming with frontmatter origin pointers. Cross-cutting items live in `_project-knowledge/cross/` in any one repo. See any sub-repo's `_project-knowledge/README.md` for the convention (auto-created on first share via the ARIA plugin).

Substitute {sub1}, {sub2}, etc., with the relative paths of each sub-repo from the matched group entry (preserve role ordering: backend → web → mobile → custom roles in declaration order).

On N or empty input: skip; record in session cache and Step 8 report. User can add manually later or accept on a future share that triggers a fresh first-write to this group (i.e., the group's container offer fires again on the next audit-share invocation if still not satisfied).

Why session cache, not persistent cache: the container offer should re-fire across sessions because the user may have changed their mind, the CLAUDE.md may have been edited externally, or sub-repos may have been added/removed. Within a single audit-share invocation, sibling sub-repo shares share the cache so the container offer fires at most once per run.

Step 7: IDEAS-BACKLOG.md Migration (One-Time Per Project)

For each project touched in Step 5, check if migration is needed. Migration target depends on project shape:

Migration logic:

Step 8: Report

Output a summary of what happened:

## /audit share complete

- N candidates reviewed
- A shared:
  - A1 to repo: <count>
  - A2 to cross: <count>
  - A3 modified-then-shared: <count>
- B skipped:
  - B1 user-declined: <count>
  - B2 not-in-scope: <count>
  - B3 sanitization-blocked: <count>
- C deferred (will re-prompt next invocation): <count>
- M IDEAS-BACKLOG.md migrations performed: <list>

Files written:
- <repo-1>/_project-knowledge/<filename> (from <source>)
- <repo-2>/_project-knowledge/<filename> (from <source>)
- ...

Next steps:
- Review staged changes: `cd <repo-1> && git diff --cached`
- Commit and push when ready.
- Run `/index` to refresh the tag index with the new files.
- Run `/context <project-tag>` to verify discovery works.

If the user cancelled in Step 4, report: "audit-share cancelled — no actions taken."

Rules

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.