@hivey/cli 0.0.0-stage → 0.9.36

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.
Files changed (83) hide show
  1. package/README.md +235 -2
  2. package/bin/hivey.js +98 -0
  3. package/native/darwin-arm64/hivey +0 -0
  4. package/package.json +36 -4
  5. package/platforms.json +3 -0
  6. package/repo/LICENSE +201 -0
  7. package/repo/NOTICE +18 -0
  8. package/repo/README.md +148 -0
  9. package/repo/install.sh +365 -0
  10. package/repo/pets/README.md +25 -0
  11. package/repo/pets/hivey-dot/CLAUDE.md +55 -0
  12. package/repo/pets/hivey-dot/build.sh +34 -0
  13. package/repo/pets/hivey-dot/main.swift +750 -0
  14. package/repo/pets/hivey-h/CLAUDE.md +75 -0
  15. package/repo/pets/hivey-h/build.sh +34 -0
  16. package/repo/pets/hivey-h/main.swift +739 -0
  17. package/repo/pets/hivey-prompt/CLAUDE.md +59 -0
  18. package/repo/pets/hivey-prompt/build.sh +34 -0
  19. package/repo/pets/hivey-prompt/main.swift +691 -0
  20. package/repo/pets/pet.py +288 -0
  21. package/repo/pets/shared/HiveyWatch.swift +437 -0
  22. package/repo/pets/test_pet.py +122 -0
  23. package/repo/plugins/README.md +108 -0
  24. package/repo/plugins/agent-creator/herdr-plugin.toml +17 -0
  25. package/repo/plugins/dashboard/dashboard.py +507 -0
  26. package/repo/plugins/dashboard/herdr-plugin.toml +14 -0
  27. package/repo/plugins/dashboard/test_dashboard.py +134 -0
  28. package/repo/plugins/github/github.py +261 -0
  29. package/repo/plugins/github/herdr-plugin.toml +14 -0
  30. package/repo/plugins/github/test_github.py +49 -0
  31. package/repo/plugins/skills/herdr-plugin.toml +11 -0
  32. package/repo/plugins/skills/skills.md +41 -0
  33. package/repo/plugins/slack-relay/connect.py +198 -0
  34. package/repo/plugins/slack-relay/create_channel.py +134 -0
  35. package/repo/plugins/slack-relay/herdr-plugin.toml +15 -0
  36. package/repo/plugins/slack-relay/relay.py +401 -0
  37. package/repo/plugins/slack-relay/slack-app-manifest.json +30 -0
  38. package/repo/plugins/slack-relay/test_connect.py +66 -0
  39. package/repo/plugins/slack-relay/test_create_channel.py +61 -0
  40. package/repo/plugins/slack-relay/test_relay.py +254 -0
  41. package/repo/plugins/swarm-creator/herdr-plugin.toml +17 -0
  42. package/repo/plugins/swarm-watcher/dashboard.py +333 -0
  43. package/repo/plugins/swarm-watcher/herdr-plugin.toml +16 -0
  44. package/repo/plugins/swarm-watcher/usage.py +129 -0
  45. package/repo/plugins/swarm-watcher/watcher.py +191 -0
  46. package/repo/plugins/team-template/herdr-plugin.toml +15 -0
  47. package/repo/plugins/team-template/setup.py +211 -0
  48. package/repo/plugins/team-template/test_setup.py +73 -0
  49. package/repo/plugins/tts/herdr-plugin.toml +15 -0
  50. package/repo/skills/herdr/SKILL.md +214 -0
  51. package/repo/skills/hivey/SKILL.md +322 -0
  52. package/repo/skills/hivey/scripts/handoff.py +27 -0
  53. package/repo/skills/hivey/scripts/new_wiki.py +143 -0
  54. package/repo/skills/hivey-agent-creator/SKILL.md +303 -0
  55. package/repo/skills/hivey-agent-creator/references/agent-claude-md.md +256 -0
  56. package/repo/skills/hivey-agent-creator/references/global-guidelines.md +67 -0
  57. package/repo/skills/hivey-agent-creator/references/reviewer-agent.md +35 -0
  58. package/repo/skills/hivey-agent-creator/scripts/agent_context.py +76 -0
  59. package/repo/skills/hivey-agent-creator/scripts/agent_gate.py +78 -0
  60. package/repo/skills/hivey-agent-creator/scripts/setup_agent.py +288 -0
  61. package/repo/skills/hivey-agy/SKILL.md +123 -0
  62. package/repo/skills/hivey-agy/references/gemini-prompting.md +134 -0
  63. package/repo/skills/hivey-agy/scripts/agy_run.py +146 -0
  64. package/repo/skills/hivey-codex/SKILL.md +66 -0
  65. package/repo/skills/hivey-context7/SKILL.md +56 -0
  66. package/repo/skills/hivey-create-wiki/SKILL.md +329 -0
  67. package/repo/skills/hivey-grok/SKILL.md +101 -0
  68. package/repo/skills/hivey-grok/scripts/grok_run.py +139 -0
  69. package/repo/skills/hivey-swarm-creator/SKILL.md +384 -0
  70. package/repo/skills/hivey-swarm-creator/references/agent-claude-md.md +313 -0
  71. package/repo/skills/hivey-swarm-creator/references/archify-report.md +24 -0
  72. package/repo/skills/hivey-swarm-creator/references/dashboard.md +46 -0
  73. package/repo/skills/hivey-swarm-creator/references/retrospective.md +23 -0
  74. package/repo/skills/hivey-swarm-creator/references/shared-rules.md +39 -0
  75. package/repo/skills/hivey-swarm-creator/references/wiki-memory.md +30 -0
  76. package/repo/skills/hivey-swarm-creator/scripts/setup_agent.py +76 -0
  77. package/repo/skills/hivey-swarm-creator/scripts/shared_rules.py +50 -0
  78. package/repo/skills/hivey-swarm-creator/scripts/swarm_tasks.py +171 -0
  79. package/repo/skills/hivey-wiki-ingest/SKILL.md +45 -0
  80. package/repo/skills/hivey-wiki-lint/SKILL.md +38 -0
  81. package/repo/skills/hivey-wiki-list/SKILL.md +46 -0
  82. package/repo/skills/hivey-wiki-log/SKILL.md +45 -0
  83. package/repo/skills/hivey-wiki-query/SKILL.md +44 -0
@@ -0,0 +1,171 @@
1
+ #!/usr/bin/env python3
2
+ """Shared task board + event log for a swarm.
3
+
4
+ Tasks live in <root>/.swarm/tasks.json (locked on every write) and are rendered to
5
+ <root>/.swarm/TASKS.md. Every change is appended to <root>/.swarm/events.jsonl, the
6
+ swarm's timeline (addons such as the watcher may log there too). hivey's dashboard reads
7
+ tasks.json, so keep its format.
8
+
9
+ Statuses: open → in-progress → review (deliverable DONE, waiting on critic) → approved
10
+ (+ blocked at any point)
11
+ Rules: a task can be claimed only by its owner (or anyone if unowned) and only once all
12
+ its deps are approved. If a task has a `check` command, `approved` requires it to pass.
13
+ Only the critic or the coordinator can set a task to `approved`. Checks run outside the
14
+ board lock, so a long test suite doesn't stall other agents.
15
+
16
+ Usage (root is found by walking up from cwd to the folder containing .swarm/):
17
+ swarm_tasks.py add ID "title" [--owner A] [--deps T1,T2] [--path P] [--check "cmd"] [--as coordinator]
18
+ swarm_tasks.py list [--owner A] [--status S]
19
+ swarm_tasks.py claim ID --as A
20
+ swarm_tasks.py set ID STATUS --as A [--note TEXT]
21
+ swarm_tasks.py verify ID --as A # run the task's check command
22
+ swarm_tasks.py log TYPE --as A [--note TEXT] # append a free-form event
23
+ """
24
+ import argparse
25
+ import fcntl
26
+ import json
27
+ import os
28
+ import subprocess
29
+ import sys
30
+ import time
31
+ from contextlib import contextmanager
32
+ from pathlib import Path
33
+
34
+ STATUSES = ["open", "in-progress", "blocked", "review", "approved"]
35
+ APPROVERS = {"critic", "coordinator"}
36
+
37
+
38
+ def find_root(start=None):
39
+ p = Path(start or Path.cwd()).resolve()
40
+ for d in [p, *p.parents]:
41
+ if (d / ".swarm").is_dir():
42
+ return d
43
+ sys.exit("no .swarm/ folder found above the current directory — pass --root")
44
+
45
+
46
+ def log_event(root, type_, actor, **fields):
47
+ rec = {"ts": time.strftime("%Y-%m-%dT%H:%M:%S"), "type": type_, "actor": actor, **fields}
48
+ with open(Path(root) / ".swarm" / "events.jsonl", "a") as f:
49
+ f.write(json.dumps(rec) + "\n")
50
+
51
+
52
+ def write_atomic(path, text):
53
+ """Write via a temp file + rename, so readers never see a half-written file."""
54
+ tmp = Path(path).with_name(Path(path).name + ".tmp")
55
+ tmp.write_text(text)
56
+ os.replace(tmp, path)
57
+
58
+
59
+ def load(root):
60
+ path = Path(root) / ".swarm" / "tasks.json"
61
+ return json.loads(path.read_text()) if path.exists() else {"tasks": []}
62
+
63
+
64
+ @contextmanager
65
+ def board(root):
66
+ swarm = Path(root) / ".swarm"
67
+ with open(swarm / "tasks.lock", "w") as lock:
68
+ fcntl.flock(lock, fcntl.LOCK_EX)
69
+ data = load(root)
70
+ yield data
71
+ write_atomic(swarm / "tasks.json", json.dumps(data, indent=2) + "\n")
72
+ render(root, data)
73
+
74
+
75
+ def render(root, data):
76
+ rows = ["# Swarm task board", "", "_Generated from tasks.json by swarm_tasks.py; don't edit._", "",
77
+ "| ID | Task | Owner | Status | Deps | Deliverable | Check |", "|---|---|---|---|---|---|---|"]
78
+ for t in data["tasks"]:
79
+ rows.append(f"| {t['id']} | {t['title']} | {t.get('owner') or '—'} | **{t['status']}** | "
80
+ f"{','.join(t['deps']) or '—'} | {t.get('path') or '—'} | "
81
+ f"{'`' + t['check'] + '`' if t.get('check') else '—'} |")
82
+ write_atomic(Path(root) / ".swarm" / "TASKS.md", "\n".join(rows) + "\n")
83
+
84
+
85
+ def get(data, tid):
86
+ for t in data["tasks"]:
87
+ if t["id"] == tid:
88
+ return t
89
+ sys.exit(f"no task {tid}")
90
+
91
+
92
+ def run_check(root, t):
93
+ try:
94
+ r = subprocess.run(t["check"], shell=True, cwd=root, capture_output=True, text=True, timeout=900)
95
+ return r.returncode == 0, (r.stdout + r.stderr)[-1500:]
96
+ except subprocess.TimeoutExpired:
97
+ return False, "check timed out after 900s"
98
+
99
+
100
+ def main():
101
+ p = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
102
+ p.add_argument("--root")
103
+ sub = p.add_subparsers(dest="cmd", required=True)
104
+ a = sub.add_parser("add"); a.add_argument("id"); a.add_argument("title")
105
+ a.add_argument("--owner"); a.add_argument("--deps", default=""); a.add_argument("--path")
106
+ a.add_argument("--check"); a.add_argument("--as", dest="actor", default="coordinator")
107
+ ls = sub.add_parser("list"); ls.add_argument("--owner"); ls.add_argument("--status")
108
+ c = sub.add_parser("claim"); c.add_argument("id"); c.add_argument("--as", dest="actor", required=True)
109
+ s = sub.add_parser("set"); s.add_argument("id"); s.add_argument("status", choices=STATUSES)
110
+ s.add_argument("--as", dest="actor", required=True); s.add_argument("--note", default="")
111
+ v = sub.add_parser("verify"); v.add_argument("id"); v.add_argument("--as", dest="actor", required=True)
112
+ lg = sub.add_parser("log"); lg.add_argument("type"); lg.add_argument("--as", dest="actor", required=True)
113
+ lg.add_argument("--note", default="")
114
+ args = p.parse_args()
115
+ root = Path(args.root).resolve() if args.root else find_root()
116
+
117
+ if args.cmd == "list":
118
+ ts = [t for t in load(root)["tasks"] if (not args.owner or t.get("owner") == args.owner)
119
+ and (not args.status or t["status"] == args.status)]
120
+ print(json.dumps(ts, indent=2))
121
+ return
122
+ if args.cmd == "log":
123
+ log_event(root, args.type, args.actor, note=args.note)
124
+ print(json.dumps({"ok": True}))
125
+ return
126
+ if args.cmd == "set" and args.status == "approved" and args.actor not in APPROVERS:
127
+ sys.exit(f"only the critic or coordinator can approve {args.id} — set it to review and tell the critic")
128
+ if args.cmd == "verify" or (args.cmd == "set" and args.status == "approved"):
129
+ t = get(load(root), args.id)
130
+ if t.get("check"): # run outside the board lock: a check can take minutes
131
+ ok, out = run_check(root, t)
132
+ log_event(root, "check_pass" if ok else "check_fail", args.actor, task=args.id, output=out[-300:])
133
+ if not ok:
134
+ print(out)
135
+ sys.exit(f"check FAILED for {args.id}" + (" — not approved" if args.cmd == "set" else ""))
136
+ if args.cmd == "verify":
137
+ print(out)
138
+ print(f"check passed for {args.id}")
139
+ return
140
+ elif args.cmd == "verify":
141
+ sys.exit(f"{args.id} has no check command")
142
+
143
+ with board(root) as data:
144
+ if args.cmd == "add":
145
+ if any(t["id"] == args.id for t in data["tasks"]):
146
+ sys.exit(f"task {args.id} already exists")
147
+ t = {"id": args.id, "title": args.title, "owner": args.owner, "status": "open",
148
+ "deps": [d for d in args.deps.split(",") if d], "path": args.path, "check": args.check,
149
+ "notes": []}
150
+ data["tasks"].append(t)
151
+ log_event(root, "task_added", args.actor, task=args.id, title=args.title, owner=args.owner)
152
+ elif args.cmd == "claim":
153
+ t = get(data, args.id)
154
+ if t.get("owner") and t["owner"] != args.actor:
155
+ sys.exit(f"{args.id} is owned by {t['owner']} — don't duplicate it; ask them or the coordinator")
156
+ waiting = [d for d in t["deps"] if get(data, d)["status"] != "approved"]
157
+ if waiting:
158
+ sys.exit(f"{args.id} waits on unapproved deps: {', '.join(waiting)} — work on something unblocked")
159
+ t["owner"], t["status"] = args.actor, "in-progress"
160
+ log_event(root, "task_claimed", args.actor, task=args.id)
161
+ elif args.cmd == "set":
162
+ t = get(data, args.id)
163
+ t["status"] = args.status
164
+ if args.note:
165
+ t["notes"].append(f"{time.strftime('%Y-%m-%d %H:%M')} {args.actor}: {args.note}")
166
+ log_event(root, "task_status", args.actor, task=args.id, status=args.status, note=args.note)
167
+ print(json.dumps(t, indent=2))
168
+
169
+
170
+ if __name__ == "__main__":
171
+ main()
@@ -0,0 +1,45 @@
1
+ ---
2
+ name: hivey-wiki-ingest
3
+ description: >
4
+ Ingest a source into the wiki of the agent/swarm you are in (its own `<name>-wiki/` folder in the same directory),
5
+ following that vault's CLAUDE.md Ingest workflow. Copies the source to raw/, creates or updates wiki pages,
6
+ refreshes index.md, appends to log.md.
7
+ Usage: /hivey-wiki-ingest <source-path-or-description>
8
+ argument-hint: <source-path-or-description>
9
+ allowed-tools:
10
+ - Bash
11
+ - Read
12
+ - Write
13
+ - Edit
14
+ - Glob
15
+ ---
16
+
17
+ > Local additions: if `EXTRA_SKILL.md` exists in this skill's folder, read it too and follow it.
18
+ > It holds this machine's own additions; hivey updates never touch it, so put local changes
19
+ > there, never here.
20
+ >
21
+ > Arguments: Claude Code puts what the user wrote after the skill name in the arguments
22
+ > placeholder below; in Codex (or any other agent), take it from the user's request.
23
+
24
+ # Wiki Ingest
25
+
26
+ Arguments: `$ARGUMENTS` — a file path to ingest, or a free-form description of what to file.
27
+
28
+ ## Finding the vault (do this first)
29
+ The wiki is the `<name>-wiki/` folder of the agent or swarm you are working in (older vaults: `obsidian/`), the same
30
+ as that agent's own memory: walk up from the current directory and take the first such folder that contains a
31
+ `CLAUDE.md` (call it `<vault>`).
32
+ Only when there is none, and the user gave a slug, fall back to `~/Obsidian/<slug>-wiki/`. Never pick another
33
+ agent's vault by guessing. An optional first word that is not a path and not part of the request is a slug only for
34
+ that fallback. Where the vault's own `CLAUDE.md` puts `index.md` and `log.md` (vault root or `wiki/`) and what
35
+ format its log uses, follow it; do not impose another layout.
36
+
37
+ ## Steps
38
+
39
+ 1. Resolve `<vault>` as above. If none is found and no slug was given, say so and offer `/hivey-create-wiki`.
40
+ 2. **Read `<vault>/CLAUDE.md` in full**: it is the source of truth for this wiki's ingest workflow, page format,
41
+ citation rules and folders. Follow it exactly.
42
+ 3. If the source is a file path, copy it into the right `<vault>/raw/` sub-folder (keep the filename; create
43
+ `raw/` if missing). If it is a description, find the underlying material first and ask when unclear.
44
+ 4. Execute the vault's Ingest workflow (summary page, update related pages, links, refresh `index.md`, append to `log.md`).
45
+ 5. End with a short summary: pages created, pages updated, and the new `log.md` line.
@@ -0,0 +1,38 @@
1
+ ---
2
+ name: hivey-wiki-lint
3
+ description: >
4
+ Run a health check on the wiki of the agent/swarm you are in (its own `<name>-wiki/` folder in the same directory):
5
+ contradictions, stale claims, orphan pages, missing cross-references, format compliance, source-coverage gaps.
6
+ Reports findings as a numbered list, does not auto-fix.
7
+ Usage: /hivey-wiki-lint
8
+ allowed-tools:
9
+ - Bash
10
+ - Read
11
+ - Glob
12
+ - Grep
13
+ ---
14
+
15
+ > Local additions: if `EXTRA_SKILL.md` exists in this skill's folder, read it too and follow it.
16
+ > It holds this machine's own additions; hivey updates never touch it, so put local changes
17
+ > there, never here.
18
+
19
+ # Wiki Lint
20
+
21
+ ## Finding the vault (do this first)
22
+ The wiki is the `<name>-wiki/` folder of the agent or swarm you are working in (older vaults: `obsidian/`), the same
23
+ as that agent's own memory: walk up from the current directory and take the first such folder that contains a
24
+ `CLAUDE.md` (call it `<vault>`).
25
+ Only when there is none, and the user gave a slug, fall back to `~/Obsidian/<slug>-wiki/`. Never pick another
26
+ agent's vault by guessing. An optional first word that is not a path and not part of the request is a slug only for
27
+ that fallback. Where the vault's own `CLAUDE.md` puts `index.md` and `log.md` (vault root or `wiki/`) and what
28
+ format its log uses, follow it; do not impose another layout.
29
+
30
+ ## Steps
31
+
32
+ 1. Resolve `<vault>`. If none is found, stop with a clear error.
33
+ 2. **Read `<vault>/CLAUDE.md`**: it defines the lint workflow (checks, what counts as stale, coverage gaps). Follow it.
34
+ 3. Walk every file under `<vault>/wiki/` (and `index.md`). Use Grep for the wiki-link inventory
35
+ (`\[\[([^\]]+)\]\]`) and for the page-format fields the vault requires.
36
+ 4. Report a numbered list: the issue, the affected page(s), a suggested fix. Do **not** auto-fix.
37
+ 5. Append a `lint` line to the vault's `log.md` in its own format (`Findings: N contradictions, M orphans, ...`).
38
+ Offer to file the findings as a page; do not assume.
@@ -0,0 +1,46 @@
1
+ ---
2
+ name: hivey-wiki-list
3
+ description: >
4
+ List the wiki vault of the agent/swarm you are in (its `<name>-wiki/` folder in the same directory) and, with
5
+ `--all`, every `<name>-wiki/` vault under ~/swarms and ~/agents plus the legacy ~/Obsidian/*-wiki/ vaults, each with
6
+ purpose, page count and last log entry.
7
+ Usage: /hivey-wiki-list [--all]
8
+ allowed-tools:
9
+ - Bash
10
+ ---
11
+
12
+ > Local additions: if `EXTRA_SKILL.md` exists in this skill's folder, read it too and follow it.
13
+ > It holds this machine's own additions; hivey updates never touch it, so put local changes
14
+ > there, never here.
15
+ >
16
+ > Arguments: Claude Code puts what the user wrote after the skill name in the arguments
17
+ > placeholder below; in Codex (or any other agent), take it from the user's request.
18
+
19
+ # Wiki List
20
+
21
+ Default: report only the vault of the folder you are in (nearest `<name>-wiki/`, or older `obsidian/`, with a
22
+ `CLAUDE.md`, walking up).
23
+ With `--all`: also every other vault.
24
+
25
+ ```bash
26
+ bash -c '
27
+ shopt -s nullglob
28
+ show() { d="$1"; name="$2"
29
+ purpose=$(grep -m1 -v "^#" "$d/CLAUDE.md" 2>/dev/null | grep -v "^$" | head -c 140)
30
+ pages=$(find "$d/wiki" -name "*.md" 2>/dev/null | wc -l | tr -d " ")
31
+ last=$( (grep -m1 -E "^(## \[)?[0-9]{4}-[0-9]{2}-[0-9]{2}" "$d/log.md" || grep -E "^## \[[0-9]{4}" "$d/wiki/log.md" | tail -1) 2>/dev/null | head -c 100)
32
+ printf "• %s (%s)\n %s pages | last: %s\n %s\n\n" "$name" "$d" "$pages" "${last:-never}" "${purpose:-(no purpose)}"; }
33
+ here=""; p="$PWD"
34
+ while [ "$p" != "/" ]; do
35
+ here=$(find "$p" -mindepth 2 -maxdepth 2 -name CLAUDE.md \( -path "$p/*-wiki/CLAUDE.md" -o -path "$p/obsidian/CLAUDE.md" \) 2>/dev/null | head -1)
36
+ [ -n "$here" ] && { here=$(dirname "$here"); break; }; p=$(dirname "$p")
37
+ done
38
+ [ -n "$here" ] && show "$here" "this folder" || echo "No <name>-wiki/ vault in this folder or above."
39
+ if [ "$1" = "--all" ]; then
40
+ for d in ~/swarms/*/*-wiki ~/swarms/*/obsidian ~/agents/*/*-wiki ~/agents/*/obsidian ~/Obsidian/*-wiki; do
41
+ [ -f "$d/CLAUDE.md" ] && [ "$(cd "$d" && pwd -P)" != "$(cd "${here:-/}" && pwd -P)" ] && show "$d" "$(basename "$d")"
42
+ done
43
+ fi' _ $ARGUMENTS
44
+ ```
45
+
46
+ If no vault exists, suggest `/hivey-create-wiki`.
@@ -0,0 +1,45 @@
1
+ ---
2
+ name: hivey-wiki-log
3
+ description: >
4
+ Show the most recent entries of the log.md of the wiki of the agent/swarm you are in (its `<name>-wiki/` folder in
5
+ the same directory).
6
+ Usage: /hivey-wiki-log [count]
7
+ argument-hint: [count]
8
+ allowed-tools:
9
+ - Bash
10
+ ---
11
+
12
+ > Local additions: if `EXTRA_SKILL.md` exists in this skill's folder, read it too and follow it.
13
+ > It holds this machine's own additions; hivey updates never touch it, so put local changes
14
+ > there, never here.
15
+ >
16
+ > Arguments: Claude Code puts what the user wrote after the skill name in the arguments
17
+ > placeholder below; in Codex (or any other agent), take it from the user's request.
18
+
19
+ # Wiki Log
20
+
21
+ Arguments: `$ARGUMENTS` — optional number of entries (default 10).
22
+
23
+ ## Finding the vault (do this first)
24
+ The wiki is the `<name>-wiki/` folder of the agent or swarm you are working in (older vaults: `obsidian/`), the same
25
+ as that agent's own memory: walk up from the current directory and take the first such folder that contains a
26
+ `CLAUDE.md` (call it `<vault>`).
27
+ Only when there is none, and the user gave a slug, fall back to `~/Obsidian/<slug>-wiki/`. Never pick another
28
+ agent's vault by guessing. An optional first word that is not a path and not part of the request is a slug only for
29
+ that fallback. Where the vault's own `CLAUDE.md` puts `index.md` and `log.md` (vault root or `wiki/`) and what
30
+ format its log uses, follow it; do not impose another layout.
31
+
32
+ ```bash
33
+ count="${ARGUMENTS:-10}"; p="$PWD"; v=""
34
+ while [ "$p" != "/" ]; do
35
+ v=$(find "$p" -mindepth 2 -maxdepth 2 -name CLAUDE.md \( -path "$p/*-wiki/CLAUDE.md" -o -path "$p/obsidian/CLAUDE.md" \) 2>/dev/null | head -1)
36
+ [ -n "$v" ] && { v=$(dirname "$v"); break; }; p=$(dirname "$p")
37
+ done
38
+ [ -n "$v" ] || { echo "No <name>-wiki/ vault in this folder or above"; exit 1; }
39
+ log="$v/log.md"; [ -f "$log" ] || log="$v/wiki/log.md"
40
+ [ -f "$log" ] || { echo "No log.md in $v"; exit 1; }
41
+ grep -nE "^(## \[)?[0-9]{4}-[0-9]{2}-[0-9]{2}" "$log" | head -"$count"
42
+ ```
43
+
44
+ Note: some vaults list newest first (head), others append (use tail); check the vault's CLAUDE.md. Offer to dig
45
+ into noteworthy entries.
@@ -0,0 +1,44 @@
1
+ ---
2
+ name: hivey-wiki-query
3
+ description: >
4
+ Answer a question from the wiki of the agent/swarm you are in (its own `<name>-wiki/` folder in the same
5
+ directory): read index.md, synthesize from the relevant pages, cite them, offer to file the answer back.
6
+ Usage: /hivey-wiki-query <question>
7
+ argument-hint: <question>
8
+ allowed-tools:
9
+ - Bash
10
+ - Read
11
+ - Write
12
+ - Glob
13
+ - Grep
14
+ ---
15
+
16
+ > Local additions: if `EXTRA_SKILL.md` exists in this skill's folder, read it too and follow it.
17
+ > It holds this machine's own additions; hivey updates never touch it, so put local changes
18
+ > there, never here.
19
+ >
20
+ > Arguments: Claude Code puts what the user wrote after the skill name in the arguments
21
+ > placeholder below; in Codex (or any other agent), take it from the user's request.
22
+
23
+ # Wiki Query
24
+
25
+ Arguments: `$ARGUMENTS` — the question.
26
+
27
+ ## Finding the vault (do this first)
28
+ The wiki is the `<name>-wiki/` folder of the agent or swarm you are working in (older vaults: `obsidian/`), the same
29
+ as that agent's own memory: walk up from the current directory and take the first such folder that contains a
30
+ `CLAUDE.md` (call it `<vault>`).
31
+ Only when there is none, and the user gave a slug, fall back to `~/Obsidian/<slug>-wiki/`. Never pick another
32
+ agent's vault by guessing. An optional first word that is not a path and not part of the request is a slug only for
33
+ that fallback. Where the vault's own `CLAUDE.md` puts `index.md` and `log.md` (vault root or `wiki/`) and what
34
+ format its log uses, follow it; do not impose another layout.
35
+
36
+ ## Steps
37
+
38
+ 1. Resolve `<vault>`. If no question was given, ask for it.
39
+ 2. Read `<vault>/index.md` first (or `wiki/index.md` per the vault's CLAUDE.md), then `<vault>/CLAUDE.md` for its
40
+ question-answering rules.
41
+ 3. Pick the relevant pages from the index, read them, synthesize with citations to the pages used
42
+ (`(see wiki/<page>.md)`). If no page is relevant, say so; do not invent.
43
+ 4. If the synthesis is worth keeping, **offer** to file it as a new page (propose path and one-line summary);
44
+ write only after confirmation, then update the index and append a `query` line to the log in the vault's format.