@indigoai-us/hq-cli 5.109.15 → 5.110.0

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 (80) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/assets/bot-workers/setup/context/USER-GUIDE.md +363 -0
  3. package/assets/bot-workers/setup/context/quick-reference.md +199 -0
  4. package/assets/bot-workers/setup/skills/first-company.md +71 -0
  5. package/assets/bot-workers/setup/skills/standing-help.md +74 -0
  6. package/assets/bot-workers/setup/worker.yaml +422 -0
  7. package/dist/commands/bot-continuity.d.ts +28 -0
  8. package/dist/commands/bot-continuity.js +68 -0
  9. package/dist/commands/bot.d.ts +73 -0
  10. package/dist/commands/bot.js +776 -0
  11. package/dist/commands/workers.d.ts +2 -14
  12. package/dist/commands/workers.js +2 -8
  13. package/dist/lib/bot/api.d.ts +202 -0
  14. package/dist/lib/bot/api.js +202 -0
  15. package/dist/lib/bot/company-bind.d.ts +27 -0
  16. package/dist/lib/bot/company-bind.js +62 -0
  17. package/dist/lib/bot/config.d.ts +106 -0
  18. package/dist/lib/bot/config.js +141 -0
  19. package/dist/lib/bot/continuity-download.d.ts +28 -0
  20. package/dist/lib/bot/continuity-download.js +75 -0
  21. package/dist/lib/bot/continuity-install.d.ts +14 -0
  22. package/dist/lib/bot/continuity-install.js +101 -0
  23. package/dist/lib/bot/continuity.d.ts +66 -0
  24. package/dist/lib/bot/continuity.js +301 -0
  25. package/dist/lib/bot/creds.d.ts +24 -0
  26. package/dist/lib/bot/creds.js +51 -0
  27. package/dist/lib/bot/daemon.d.ts +75 -0
  28. package/dist/lib/bot/daemon.js +316 -0
  29. package/dist/lib/bot/inbox-state.d.ts +18 -0
  30. package/dist/lib/bot/inbox-state.js +51 -0
  31. package/dist/lib/bot/index.d.ts +16 -0
  32. package/dist/lib/bot/index.js +16 -0
  33. package/dist/lib/bot/inflight.d.ts +40 -0
  34. package/dist/lib/bot/inflight.js +44 -0
  35. package/dist/lib/bot/log.d.ts +13 -0
  36. package/dist/lib/bot/log.js +59 -0
  37. package/dist/lib/bot/owner-context.d.ts +75 -0
  38. package/dist/lib/bot/owner-context.js +151 -0
  39. package/dist/lib/bot/paths.d.ts +61 -0
  40. package/dist/lib/bot/paths.js +103 -0
  41. package/dist/lib/bot/progress.d.ts +84 -0
  42. package/dist/lib/bot/progress.js +167 -0
  43. package/dist/lib/bot/promote.d.ts +16 -0
  44. package/dist/lib/bot/promote.js +106 -0
  45. package/dist/lib/bot/promotion-hold.d.ts +24 -0
  46. package/dist/lib/bot/promotion-hold.js +103 -0
  47. package/dist/lib/bot/promotion-receipt.d.ts +9 -0
  48. package/dist/lib/bot/promotion-receipt.js +56 -0
  49. package/dist/lib/bot/promotion-upload.d.ts +16 -0
  50. package/dist/lib/bot/promotion-upload.js +65 -0
  51. package/dist/lib/bot/prompt.d.ts +103 -0
  52. package/dist/lib/bot/prompt.js +329 -0
  53. package/dist/lib/bot/room-policy.d.ts +53 -0
  54. package/dist/lib/bot/room-policy.js +73 -0
  55. package/dist/lib/bot/run.d.ts +98 -0
  56. package/dist/lib/bot/run.js +787 -0
  57. package/dist/lib/bot/runtime/claude.d.ts +49 -0
  58. package/dist/lib/bot/runtime/claude.js +151 -0
  59. package/dist/lib/bot/runtime/codex.d.ts +28 -0
  60. package/dist/lib/bot/runtime/codex.js +147 -0
  61. package/dist/lib/bot/runtime/grok.d.ts +16 -0
  62. package/dist/lib/bot/runtime/grok.js +67 -0
  63. package/dist/lib/bot/runtime/index.d.ts +35 -0
  64. package/dist/lib/bot/runtime/index.js +279 -0
  65. package/dist/lib/bot/runtime/messages-stream.d.ts +27 -0
  66. package/dist/lib/bot/runtime/messages-stream.js +85 -0
  67. package/dist/lib/bot/runtime/types.d.ts +136 -0
  68. package/dist/lib/bot/runtime/types.js +51 -0
  69. package/dist/lib/bot/scaffold.d.ts +38 -0
  70. package/dist/lib/bot/scaffold.js +94 -0
  71. package/dist/lib/bot/session.d.ts +19 -0
  72. package/dist/lib/bot/session.js +39 -0
  73. package/dist/lib/bot/status.d.ts +40 -0
  74. package/dist/lib/bot/status.js +66 -0
  75. package/dist/lib/bot/worker-source.d.ts +66 -0
  76. package/dist/lib/bot/worker-source.js +283 -0
  77. package/dist/lib/workers-registry/read.d.ts +15 -0
  78. package/dist/lib/workers-registry/read.js +17 -0
  79. package/dist/register-all.js +2 -0
  80. package/package.json +3 -2
package/CHANGELOG.md CHANGED
@@ -2,6 +2,41 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [5.110.0] — 2026-09-14
6
+
7
+ ### Added
8
+
9
+ - `hq bot`: personal local bots that run on your own computer under your Claude
10
+ Code, Codex, or Grok sign-in, with their own HQ identity and your permissions.
11
+ `hq bot create|list|status|start|stop|restart|rm|workers|set|logs` manage them;
12
+ each bot runs as a launchd agent, answers your DMs, can join group chats and
13
+ company channels, and can start from a company worker (`--worker`).
14
+ - The HQ setup bot: `hq bot create setup --worker setup` uses the setup worker
15
+ bundled with the CLI, so a fresh install can be walked through setup before
16
+ core workers have synced.
17
+ - Bots post their in-between messages while they work, have no turn time limit
18
+ (`HQ_BOT_TURN_TIMEOUT_MS` is opt-in), always reply, and never re-run a message
19
+ that already started.
20
+ - Per-bot model and thinking level (`hq bot set <name> --model --effort`),
21
+ read fresh on every turn.
22
+ - `hq bot promote`: move a local bot to the cloud as the same identity
23
+ (requires the matching backend release).
24
+
25
+ ### Fixed
26
+
27
+ - Bots no longer tell their owner they belong to no company: owner DM turns
28
+ carry the owner's companies, looked up with the owner's own sign-in, because
29
+ `hq` lookups a bot runs describe the bot itself.
30
+ - Stopping a bot's turn stops everything the model started, instead of waiting
31
+ for a child process that still holds the output open.
32
+
33
+ ## [5.109.16] — 2026-09-14
34
+
35
+ ### Changed
36
+
37
+ - hq-cloud now uses 6.16.41, which reverts the phase-two resident journal change
38
+ that caused sync runners to spin.
39
+
5
40
  ## [5.109.15] — 2026-09-13
6
41
 
7
42
  ### Changed
@@ -0,0 +1,363 @@
1
+ # HQ User Guide
2
+
3
+ The AI operating system for your company. A shared context layer on top of Claude Code, Cursor, and Codex — syncs knowledge, skills, and capabilities across your team. Scales from solopreneur to enterprise.
4
+
5
+ For a first-time setup, begin with the **[guided HQ tutorial](https://www.hqforwork.com/getting-started/tutorials/install-hq-macos?source=hq_user_guide)**. Its seven videos, written walkthroughs, and screenshots take you from installation through your first shared worker. The `/tutorial` command below is the complementary adaptive course inside your local HQ.
6
+
7
+ ## Prerequisites & platforms
8
+
9
+ HQ's shell layer (hooks, scripts, skills) runs on **Linux, macOS, and Windows Git Bash**. Required tools: bash, git, node, **jq**.
10
+
11
+ Per-OS install commands, known limitations (including `/deploy` identity `missing_dependency`), and contributor conventions (`portable.sh`, `hook-lib.sh`) live in:
12
+
13
+ → [core/knowledge/public/hq-core/cross-platform-support.md](../../knowledge/public/hq-core/cross-platform-support.md)
14
+
15
+ If a skill is skipped as invalid YAML or a hook reports a launch failure, use the runtime-contract troubleshooting section in that guide. HQ attempts safe execute-bit repair first; unrecoverable failures include an exact remediation command without exposing hook payloads or secrets.
16
+
17
+ ## Commands
18
+
19
+ ### Session Management
20
+ | Command | What it does |
21
+ |---------|--------------|
22
+ | `/startwork` | Pick company/project/repo, gather context |
23
+ | `/checkpoint` | Save progress to `workspace/checkpoints/` |
24
+ | `/handoff` | Prepare handoff for fresh session |
25
+ | `/delegate <recipient> [project]` | Hand a project to a teammate or fleet agent with exact grant receipts, a published dossier, local board and PRD ownership updates, and a pickup DM. Recipient access and Work Mesh ownership require separate confirmation. Requires HQ CLI 5.109.7+. `--share` keeps ownership; `--dry-run` changes nothing |
26
+ | `/recover-session` | Recover dead sessions that hit context limits |
27
+ | `/learn` | Auto-capture learnings from task execution |
28
+
29
+ ### Planning & Projects
30
+ | Command | What it does |
31
+ |---------|--------------|
32
+ | `/brainstorm` | Explore approaches and tradeoffs before committing to a PRD |
33
+ | `/plan` | Lightweight plan for a new project |
34
+ | `/deep-plan` | Deep planning with research subagents and tiered interview |
35
+ | `/idea` | Capture a project idea on the board without a full PRD |
36
+ | `/strategize` | Strategic prioritization — "what should I work on next?" |
37
+ | `/goals` | View and manage OKR structure |
38
+ | `/run-project` | Execute a PRD via Ralph loop / Codex runtime |
39
+ | `/run-pipeline` | Multi-project pipeline orchestrator |
40
+ | `/execute-task` | Execute a single PRD story through coordinated workers |
41
+ | `/architect` | Surface architectural friction and propose deepening opportunities |
42
+ | `/review-plan` | Stress-test a plan or PRD (EXPANSION / HOLD / REDUCTION modes) |
43
+
44
+ ### Quality, Debugging & Review
45
+ | Command | What it does |
46
+ |---------|--------------|
47
+ | `hq doctor` | Verify HQ hook guardrails are wired and firing (read-only, offline) — see [hq doctor](#hq-doctor--hook-guardrail-diagnostics) |
48
+ | `/tdd` | Enforce test-driven development cycle |
49
+ | `/quality-gate` | Pre-commit quality checks (typecheck, lint, test, coverage) |
50
+ | `/investigate` | Iron Law debugging — root-cause investigation before fixes |
51
+ | `/diagnose` | Disciplined diagnosis loop for hard / intermittent bugs |
52
+ | `/review` | Review a pull request |
53
+ | `/retro` | Project or session retrospective |
54
+ | `/document-release` | Post-ship documentation sync |
55
+ | `/calibration-report` | Estimation calibration vs. actuals |
56
+ | `/track-estimate` | Record an estimate for a task |
57
+ | `/finish-estimate` | Close out an estimate with actuals |
58
+
59
+ ### Workers
60
+ | Command | What it does |
61
+ |---------|--------------|
62
+ | `/run` | List workers |
63
+ | `/run {worker}` | Show worker's skills |
64
+ | `/run {worker} {skill}` | Execute skill |
65
+ | `/newworker` | Create new worker |
66
+
67
+ ### Knowledge & Decisions
68
+ | Command | What it does |
69
+ |---------|--------------|
70
+ | `/adr` | Capture an Architectural Decision Record |
71
+ | `/out-of-scope` | Record what was deliberately rejected and why |
72
+ | `/search` | Search across HQ and indexed repos (qmd-powered) |
73
+ | `/garden` | Detect stale, duplicate, inaccurate content |
74
+
75
+ ### Land & Ship
76
+ | Command | What it does |
77
+ |---------|--------------|
78
+ | `/land` | Land a PR — monitor CI, resolve review issues, merge, monitor production |
79
+ | `/land-batch` | Triage, review, and sequentially merge multiple open PRs |
80
+
81
+ ### HQ Services & Sync
82
+ | Command | What it does |
83
+ |---------|--------------|
84
+ | `/hq-login` | Sign in to HQ Cognito (browser flow) |
85
+ | `/hq-logout` | Clear local Cognito session |
86
+ | `/hq-whoami` | Show current HQ identity + token expiry |
87
+ | `/hq-sync` | Run a full HQ sync across cloud-backed companies |
88
+ | `/resolve-conflicts` | Walk through HQ Sync conflicts interactively |
89
+
90
+ ### HQ CLI: Files (vault sharing)
91
+
92
+ These are CLI commands (not slash commands) — direct surface for HQ vault access control. Full reference: `.claude/skills/hq-files/SKILL.md`.
93
+
94
+ | Command | What it does |
95
+ |---------|--------------|
96
+ | `hq files share <prefix>...` | **Browser flow** — opens a share-session page where you batch-pick recipients (members, groups, "Share with All") with per-recipient read/write. Add `--no-open` to print the URL only. |
97
+ | `hq files share <prefix> --with <email\|grp_*\|@all> --permission <read\|write>` | **Direct grant** — single recipient (or `@all` for company-wide) without leaving the terminal |
98
+ | `hq files unshare <prefix> --with <principal>` | Revoke a grant (idempotent — exits 0 if already absent) |
99
+ | `hq files acl <prefix>` | Show ACL entries, creator, and your effective permission |
100
+
101
+ Share-session URLs are encrypted single-use 15-minute capabilities — never paste them into commits, threads, or logs. See policy `core/policies/hq-share-session-urls-are-capabilities.md`.
102
+
103
+ ### HQ CLI: Vault databases (`hq db`)
104
+
105
+ Structured storage for agent and app state — not a replacement for markdown knowledge. Full guide: `core/knowledge/public/hq-core/vault-databases.md`. CLI: `@indigoai-us/hq-cli` ≥ 5.62.0.
106
+
107
+ | Command | What it does |
108
+ |---------|--------------|
109
+ | `hq db status --company {co}` | Create/open local SQLite at `~/.hq/db/{co}/vault.db` (WAL) |
110
+ | `hq db sql --company {co} -- 'SELECT …'` | Query the company local DB (read-only by default) |
111
+ | `hq db migrate --company {co} --hq-root {HQ}` | Apply reviewable SQL under `companies/{co}/db/migrations/` |
112
+ | `hq db provision --company {co}` | Remote DB on **HQ Team** plan only (secrets never printed) |
113
+
114
+ Use local for single-machine agent skills and implementer standards. Use Team remote for multi-machine shared data and deploy SecretBinding. Never commit `*.db` files into the vault tree.
115
+
116
+ ### HQ CLI: Direct messages (`hq dm`)
117
+
118
+ Send a person-to-person notification to a teammate. They receive it in their HQ Desktop App. Full reference: `.claude/skills/dm/SKILL.md` (`/dm`).
119
+
120
+ | Command | What it does |
121
+ |---------|--------------|
122
+ | `hq dm <email\|prs_*> "<message>"` | Send a DM — recipient gets a macOS notification in the HQ Desktop App |
123
+ | `hq dm <r> "<m>" --prompt "<context>"` | Attach agent context — recipient gets a one-click **Copy prompt** action to paste into their own agent |
124
+ | `hq dm <r> "<m>" --details "<text>"` (or `--details-file <path>`) | Longer text shown in the recipient's **Open details** window |
125
+ | `hq dm <r> "<m>" --at <iso>` / `--in <30s\|10m\|2h\|1d>` | Schedule delivery (store-and-forward — arrives even if you're offline at that time) |
126
+
127
+ Receiving is handled by the **HQ Desktop App** (it's receive-only — there's no send UI; sending is session/CLI only). You can only DM someone you share an active company with; DM your own email for a note-to-self or reminder. Never put secrets in a DM body/prompt/details — they're stored server-side.
128
+
129
+ ### Company & Infrastructure
130
+ | Command | What it does |
131
+ |---------|--------------|
132
+ | `/newcompany` | Scaffold new company with full infrastructure |
133
+ | `/designate-team` | Mark a company directory as cloud-backed |
134
+ | `/sync-registry` | Regenerate a company's resource registry index |
135
+ | `/discover` | Pull a repo into HQ and synthesize structured knowledge |
136
+ | `/import-context` | Scan the machine for prior AI artifacts and conversation history (Claude Code, Codex, Grok, claude.ai) and import into HQ (alias: `/import-claude`) |
137
+ | `/setup` | Interactive setup wizard for HQ Starter Kit |
138
+ | `/update-hq` | Upgrade HQ from latest hq-core release |
139
+ | `/convert-codex` | Additive conversion so Codex has first-class AGENTS.md guidance |
140
+ | `/tutorial` | Interactive hands-on tutorial on HQ principles and workflow |
141
+ | `/harness-audit` | Score HQ setup quality across categories |
142
+ | `/cleanup` | Audit and clean HQ to enforce current policies |
143
+
144
+ ### Misc
145
+ | Command | What it does |
146
+ |---------|--------------|
147
+ | `/personal-interview` | Deep interview to populate profile / voice |
148
+ | `/ascii-graphic` | Generate ASCII block-art banners for posts and OG images |
149
+
150
+ ## hq doctor — hook guardrail diagnostics
151
+
152
+ `hq doctor` is the single command that answers whether your HQ hook guardrails
153
+ are actually wired and firing, on whichever agent platform you are running
154
+ (Claude Code, Codex, or Grok Build). It is read-only and fully offline — no HQ
155
+ login, no vault access, no network — because it has to work precisely when the
156
+ rest of the toolchain is suspect. It absorbs the older `check-hq-hooks.sh` (now a
157
+ thin wrapper that calls `hq doctor` and degrades to an inline check when the CLI
158
+ is absent) and the `/harness-audit` hook-coverage score.
159
+
160
+ | Invocation | What it does |
161
+ |------------|--------------|
162
+ | `hq doctor` | Wiring checks: every hook registration across Claude/Codex/Grok is present, executable, correctly gated, and not word-split; plus the runtime probe (did hooks actually fire this session). Never executes a hook. |
163
+ | `hq doctor --deep-test` | Everything above, then actually fires your blocking hooks with crafted inputs through the real `hook-gate.sh` under all three profiles — in a throwaway sandbox, never your live tree — to prove they block what they claim to. |
164
+ | `hq doctor --fix` | Applies only the allowlisted safe repairs (restore an executable bit, add a hook id to gate profiles it is missing from, re-register an on-disk hook) behind a backup, a diff preview, interactive confirmation, and a dirty-tree refusal. Never rewrites a hook's body or deletes a file. |
165
+ | `hq doctor --json` | Emits the machine-readable, versioned document (schema version, detected platform, resolved root, and every result). This is what `/harness-audit` and CI consume. |
166
+ | `hq doctor --session-id <id>` | Scopes the runtime probe's ledger check to that exact session, so an older session's ledger cannot be mistaken for the current runtime (useful on app/SDK hosts). |
167
+
168
+ **Exit code:** `0` unless some result is `FAIL` or `UNKNOWN`; `1` when any is.
169
+ `WARN`, `UNTESTED`, `NA`, and `KNOWN-DEFECT` are reported but never fail the
170
+ command — a doctor that goes red on a healthy install would train you to ignore
171
+ it, which is the exact failure mode it exists to prevent.
172
+
173
+ **Status vocabulary** (the load-bearing part — these never collapse into `PASS`):
174
+
175
+ | Status | Meaning |
176
+ |--------|---------|
177
+ | `PASS` | Verified correct. |
178
+ | `FAIL` | Verified broken — fix it. |
179
+ | `WARN` | Non-blocking concern worth a look (e.g. an orphaned hook, a stale allowed-divergence entry). |
180
+ | `UNTESTED` | Wired but never exercised: the hook is registered but has no fixture, so its behaviour has not been proven. Coverage is reported as a `tested/total` line so this stays visible. |
181
+ | `NA` | Untestable on this platform (e.g. a Grok passive-event hook that cannot inject model-facing context). Not a pass and not a failure — the platform simply cannot run the check. |
182
+ | `UNKNOWN` | Could not be determined — the host platform was unidentifiable, or a check could not run. Fails the command rather than claiming a verdict it cannot support. |
183
+ | `KNOWN-DEFECT` | A tracked, unfixed defect pinned by an `expectedFailure` fixture marker. Always printed and counted separately, but never fails the command; if it starts passing, the doctor warns that the marker is stale. |
184
+
185
+ The distinction between `UNTESTED` / `NA` / `UNKNOWN` and `PASS` is the design's
186
+ central safeguard: a false `PASS` is worse than no tool, because it retires the
187
+ instinct to check by hand.
188
+
189
+ ## Workers
190
+
191
+ ```
192
+ /run # see all
193
+ /run frontend-designer
194
+ /run frontend-designer build
195
+ /run content-brand "tone analysis"
196
+ ```
197
+
198
+ **Standalone public workers** (`core/workers/public/`):
199
+
200
+ | Worker | Purpose |
201
+ |--------|---------|
202
+ | frontend-designer | UI generation |
203
+ | qa-tester | Automated website testing (Playwright) |
204
+ | security-scanner | Security scanning |
205
+ | pretty-mermaid | Mermaid diagram generation |
206
+ | site-builder | Static site generation |
207
+ | knowledge-tagger | Knowledge classification |
208
+ | exec-summary | Executive summary generation |
209
+ | accessibility-auditor | Accessibility checks |
210
+ | performance-benchmarker | Performance analysis |
211
+ | ascii-artist | ASCII block-art generation |
212
+ | paper-designer | Document / paper layout |
213
+
214
+ **Dev Team (18)** — `core/workers/public/dev-team/`:
215
+ project-manager, task-executor, architect, backend-dev, database-dev, frontend-dev, infra-dev, motion-designer, code-reviewer, knowledge-curator, product-planner, qa-tester, reality-checker, context-manager, codex-engine, codex-coder, codex-reviewer, codex-debugger
216
+ (Gemini CLI workers gemini-coder / gemini-reviewer install via the optional `@indigoai-us/hq-pack-gemini` pack.)
217
+
218
+ **Content Team (5)** — `core/workers/public/content-*/`:
219
+ content-brand, content-sales, content-product, content-legal, content-shared (library)
220
+
221
+ **Social Team (5)** — `core/workers/public/social-*/`:
222
+ social-shared (library), social-strategist, social-reviewer, social-publisher, social-verifier
223
+
224
+ **Gardener Team (3)** — `core/workers/public/gardener-team/`:
225
+ garden-scout, garden-auditor, garden-curator
226
+
227
+ **Company Workers** (`companies/{co}/workers/`):
228
+
229
+ Each company can scaffold its own private workers via `/newworker`. They live under `companies/{co}/workers/` and stay isolated from other companies. Use `/run {worker-id} {skill}` to invoke them.
230
+
231
+ ## Companies
232
+
233
+ Each company owns its settings, data, and knowledge.
234
+
235
+ ```
236
+ companies/
237
+ ├── _template/ # Skeleton copied when scaffolding a new company
238
+ ├── manifest.yaml # Company registry
239
+ └── {company}/ # Add one directory per company you manage (via /newcompany)
240
+ ```
241
+
242
+ A scaffolded company contains:
243
+
244
+ ```
245
+ companies/{co}/
246
+ ├── data/ # Exports, reports, journal entries
247
+ ├── hooks/ # Company-scoped hooks
248
+ ├── knowledge/ # Company knowledge base (embedded git repo)
249
+ ├── people/ # Contact / personnel records
250
+ ├── policies/ # Company-scoped rules
251
+ ├── projects/ # PRDs and project state
252
+ ├── repos/ # Symlinks → repos/{public|private}/
253
+ ├── settings/ # Credentials & config
254
+ ├── skills/ # Company-scoped skills
255
+ ├── workers/ # Company-scoped workers
256
+ └── workspace/ # Company-scoped scratch / drafts
257
+ ```
258
+
259
+ ## Projects
260
+
261
+ PRDs live at `companies/{co}/projects/{name}/prd.json` for company work, or `personal/projects/{name}/prd.json` for personal/HQ work, with `README.md` as the human-readable view.
262
+
263
+ ```
264
+ /plan "Build dashboard" # creates PRD
265
+ /run-project customer-cube # execute via Ralph loop / Codex
266
+ ```
267
+
268
+ ## Directory Structure
269
+
270
+ ```
271
+ HQ/
272
+ ├── AGENTS.md # Charter for Claude / Codex sessions
273
+ ├── .claude/
274
+ │ ├── CLAUDE.md
275
+ │ ├── commands/ # Slash commands (53)
276
+ │ ├── hooks/ # Lifecycle hooks (32)
277
+ │ ├── skills/ # Skill definitions (55)
278
+ │ ├── output-styles/
279
+ │ ├── scripts/
280
+ │ └── settings.json / settings.local.json
281
+ ├── core/
282
+ │ ├── core.yaml # Core manifest
283
+ │ ├── docs/hq/ # README, CHANGELOG, MIGRATION, USER-GUIDE
284
+ │ ├── knowledge/
285
+ │ │ ├── public/ # Bundled public knowledge bases
286
+ │ │ └── private/ # Private knowledge bases (populated via packs / sync)
287
+ │ ├── packages/ # Packaged extensions
288
+ │ ├── policies/ # Cross-cutting rules (~259)
289
+ │ ├── scripts/ # Shared shell utilities
290
+ │ ├── settings/ # Orchestrator config
291
+ │ └── workers/
292
+ │ ├── public/ # Bundled workers (dev-team, content-*, social-*, gardener-team, …)
293
+ │ └── registry.yaml
294
+ ├── companies/
295
+ │ ├── _template/ # Skeleton for new companies
296
+ │ ├── manifest.yaml
297
+ │ └── {co}/ # One directory per company
298
+ ├── personal/
299
+ │ ├── agents-profile.md
300
+ │ ├── agents-companies.md
301
+ │ ├── knowledge/
302
+ │ ├── projects/ # Personal/HQ project scratch
303
+ │ ├── policies/
304
+ │ ├── settings/
305
+ │ ├── skills/
306
+ │ └── workers/
307
+ ├── repos/
308
+ │ ├── public/ # Open-source repos
309
+ │ └── private/ # Private repos
310
+ └── workspace/
311
+ ├── baseline/ # Reference baselines
312
+ ├── checkpoints/ # Session saves
313
+ ├── drafts/ # In-flight drafts
314
+ ├── learnings/ # Captured learnings
315
+ ├── orchestrator/ # Ralph loop workflow state
316
+ ├── reports/ # Generated reports
317
+ ├── scratch/ # Free-form scratch
318
+ └── threads/ # Session threads + handoff.json
319
+ ```
320
+
321
+ ## Meeting notes, signals & ontology
322
+
323
+ HQ captures these **natively, per company** — check HQ first, not your email or a third-party notetaker.
324
+
325
+ - **Meeting notes** — recordings/transcripts the HQ meeting bot ingests into `companies/{co}/sources/meetings/`. Read them with `/meeting-notes` (or `hq meetings list|notes --company {co}`).
326
+ - **Signals** — decisions, action items, wins, risks, open questions, and commitments extracted from your meetings, in `companies/{co}/signals/`. Read them with `/signals`.
327
+ - **Ontology** — situational context about a company (who/what is active, recent decisions) via the `ontology` skill.
328
+
329
+ **Turnkey setup (activation ladder):**
330
+
331
+ 1. Make the company cloud-backed → `/designate-team {co}`.
332
+ 2. Invite the HQ meeting bot to a call → notes ingest into `companies/{co}/sources/meetings/` automatically.
333
+ 3. Signals are extracted from ingested notes into `companies/{co}/signals/`; ontology context follows.
334
+
335
+ **Your preference for "meeting notes":** defaults to HQ-native. To point a company at email instead, set `meeting_notes_source: email` in `companies/{co}/settings/knowledge/preferences.yaml` (global default lives in `personal/settings/knowledge-preferences.yaml`).
336
+
337
+ > Signals extraction and the ontology gardener run on HQ cloud and will require HQ Pro once billing ships. Billing isn't live yet — today these are provisioned per-company when you cloud-back it via `/designate-team`. Reference: `core/knowledge/public/hq-core/native-knowledge-stores.md`.
338
+
339
+ ## Typical Session
340
+
341
+ 1. `/startwork` — pick company/project/repo, gather context
342
+ 2. Do work
343
+ 3. `/checkpoint` — save progress
344
+ 4. `/handoff` — prep for next session
345
+
346
+ ## Knowledge Bases
347
+
348
+ **Public** (in `core/knowledge/public/`):
349
+ - `Ralph/` — coding methodology
350
+ - `agent-browser/` — browser automation patterns
351
+ - `ai-security-framework/` — security practices
352
+ - `dev-team/` — dev team patterns
353
+ - `getting-started/` — onboarding material
354
+ - `hq-core/` — thread schema, HQ patterns
355
+ - `loom/` — Loom agent patterns (reference)
356
+ - `projects/` — project templates
357
+ - `workers/` — worker framework reference
358
+
359
+ **Private** (in `core/knowledge/private/`):
360
+ - Empty by default — populated via packs (e.g. `@indigoai-us/hq-pack-*`) or sync.
361
+
362
+ **Company-level** (in `companies/{co}/knowledge/`):
363
+ - Each company has an embedded git repo populated through use.
@@ -0,0 +1,199 @@
1
+ ---
2
+ type: reference
3
+ domain: [operations, engineering]
4
+ status: canonical
5
+ tags: [quick-reference, directory-structure, commands, workers, knowledge-bases]
6
+ relates_to: []
7
+ ---
8
+
9
+ # HQ Quick Reference
10
+
11
+ ## Directory Structure
12
+
13
+ ```
14
+ HQ/
15
+ ├── .claude/commands/ # Slash commands (44)
16
+ ├── AGENTS.md # Runtime entrypoint (symlink to .claude/CLAUDE.md)
17
+ ├── companies/ # Company-scoped resources (14 companies)
18
+ │ └── {co}/
19
+ │ ├── knowledge/ # Embedded git repo (company knowledge)
20
+ │ ├── policies/ # Standing operational rules
21
+ │ ├── repos/ # Symlinks → repos/{pub|priv}/
22
+ │ ├── settings/ # Credentials & config
23
+ │ ├── workers/ # Company-scoped workers
24
+ │ ├── data/ # Exports, reports
25
+ │ └── board.json # OKR board
26
+ ├── core/ # System tree (canonical, shipped with HQ)
27
+ │ ├── hooks/ # Always-on system hooks (loaded first)
28
+ │ ├── docs/hq/ # Public HQ docs (README, CHANGELOG, MIGRATION, USER-GUIDE)
29
+ │ ├── knowledge/
30
+ │ │ ├── public/ # Bundled real directories tracked by hq-core
31
+ │ │ └── private/ # Private real directories when configured
32
+ │ ├── policies/ # Cross-cutting + command-scoped policies
33
+ │ ├── settings/ # Orchestrator config
34
+ │ ├── skills/ # Core skills (surface as /<skill>)
35
+ │ └── workers/
36
+ │ └── public/ # Shareable workers (dev-team, content-*, social-*, gardener-*, gemini-*, etc.)
37
+ ├── personal/ # User-personal overlay (mirrors core/ shape)
38
+ │ ├── hooks/ # Always-on user-global hooks (loaded AFTER core/hooks)
39
+ │ ├── projects/ # Personal/HQ project PRDs and brainstorms
40
+ │ ├── knowledge/ # Read directly from personal/ (no core/ mirror)
41
+ │ ├── policies/ # Read directly by the policy trigger hook (no core/ mirror)
42
+ │ ├── settings/ # Read directly from personal/ (no core/ mirror)
43
+ │ ├── skills/ # Surface as /<skill> with (project:personal) tag
44
+ │ └── workers/ # Read directly from personal/ (no core/ mirror)
45
+ ├── repos/
46
+ │ ├── public/ # Open-source code repos
47
+ │ └── private/ # Private code repos
48
+ └── workspace/
49
+ ├── checkpoints/ # Session saves
50
+ ├── orchestrator/ # Ralph loop workflow state
51
+ ├── reports/ # Generated reports
52
+ ├── social-drafts/ # Social content pipeline
53
+ └── threads/ # Session threads + handoff.json
54
+ ```
55
+
56
+ **Personal overlay semantics.** `personal/` mirrors the shape of `core/` but is user-personal authoring space. The old reindex symlink mirror into `core/` was **retired** — `personal/{knowledge,policies,settings,workers}` are now read DIRECTLY from `personal/` by the code that consumes each (the policy trigger hook, the workers-registry generator, the session/knowledge readers), and reindex prunes any leftover mirror symlinks:
57
+
58
+ | Subdir | Runtime behavior |
59
+ |---|---|
60
+ | `personal/hooks/<event>/*.sh` | **Loaded as a separate ordered layer** — runs after `core/hooks/<event>/` and before `core/packages/*/hooks/<event>/` |
61
+ | `personal/skills/<skill>/SKILL.md` | Surfaces as `/<skill>` — same flat command name as a core skill. Claude Code's `.claude/commands/<subdir>/<name>.md` surfacing puts the subdirectory in the command *description* (`(project:personal)`), not the command name. Collisions with a core skill of the same name are won by whichever ordering Claude Code resolves first; rename your personal skill to disambiguate. |
62
+ | `personal/knowledge/<entry>` | Read directly from `personal/knowledge/` (no `core/` mirror) — loads alongside core |
63
+ | `personal/policies/<entry>` | Read directly by the policy trigger hook (no `core/policies/` mirror) — loads as global; NOT a separate precedence layer |
64
+ | `personal/workers/<entry>` | Walked directly by the workers-registry generator (no `core/workers/` mirror) — surfaces as a worker |
65
+ | `personal/settings/<entry>` | Read directly from `personal/settings/` (no `core/settings/` mirror) |
66
+
67
+ Collision rule: with the mirror retired there is no link path to collide on. Both the personal and the core copy are read; a consumer that dedups by identity resolves same-id twins with personal first (e.g. the policy trigger hook scans `personal/policies/` ahead of `core/policies/`, so an operator's global rule wins over a same-id core copy).
68
+
69
+ ## Companies (14)
70
+
71
+ | Company | Workers | Key Resources |
72
+ |---------|---------|---------------|
73
+ | {company} | cfo, analyst, infobip-admin, gtm, qa, deploy | Stripe, Gusto, Deel, QB, Shopify, Linear (acme-recover) |
74
+ | {company} | cmo | AWS (Route 53), Linear, LinkedIn, Loops |
75
+ | personal | x-user, invoices, social-council | Slack, Gmail, LinkedIn, X |
76
+ | acmework | site-builder, research-agent | Stripe |
77
+ | acmestudio | — | Band/music |
78
+ | acme-haven | — | Artist site + admin |
79
+ | acme-mgmt | — | Artist manager monorepo |
80
+ | acmebrands | — | AcmeBrands AI |
81
+ | acme-estate | — | Estate platform |
82
+ | acmebrand | — | Shopify store |
83
+ | acmeflow | — | Expo mobile app |
84
+ | acmedom | — | Domain management |
85
+ | acme-rebrand | — | GTM/growth |
86
+
87
+ ## Workers
88
+
89
+ **Public (`core/workers/public/`):** frontend-designer, qa-tester, security-scanner, pretty-mermaid, site-builder, knowledge-tagger, exec-summary, accessibility-auditor, performance-benchmarker
90
+
91
+ **Dev Team (17):** `core/workers/public/dev-team/`
92
+ project-manager, task-executor, architect, backend-dev, database-dev, frontend-dev, infra-dev, motion-designer, code-reviewer, knowledge-curator, product-planner, dev-qa-tester, codex-engine, codex-coder, codex-reviewer, codex-debugger, reality-checker
93
+
94
+ **Content Team (5):** `core/workers/public/content-*/`
95
+ content-brand, content-sales, content-product, content-legal, content-shared
96
+
97
+ **Social Team (5):** `core/workers/public/social-*/`
98
+ social-shared, social-strategist, social-reviewer, social-publisher, social-verifier
99
+
100
+ **Gardener Team (3):** `core/workers/public/gardener-team/`
101
+ garden-scout, garden-auditor, garden-curator
102
+
103
+ **Gemini Team (3):** `core/workers/public/gemini-*/`
104
+ (gemini-coder, gemini-reviewer, gemini-frontend — install via @indigoai-us/hq-pack-gemini)
105
+
106
+ **Company Workers:** Located at `companies/{co}/workers/`. See manifest.yaml for full list per company.
107
+
108
+ ## Commands (44)
109
+
110
+ **Session:** `/startwork`, `/reanchor`, `/checkpoint`, `/handoff`, `/recover-session`, `/remember`, `/learn`
111
+ **Handoff:** `/delegate <recipient> [project]` — transfer a project to a person or fleet agent: vault grants (verified), branch push, secrets by name, board + work-mesh reassignment, and a self-pulling pickup DM (no `/hq-sync` needed on their side). Skill: `.claude/skills/delegate/SKILL.md`; manifest spec: `core/knowledge/public/hq-core/delegation-bundle-spec.md`.
112
+ **Workers:** `/run`, `/newworker`
113
+ **Projects:** `/plan`, `/run-project`, `/execute-task`, `/understand-project`, `/idea`, `/goals`, `/dashboard`, `/tdd`, `/quality-gate`
114
+ **Content:** `/contentidea`, `/suggestposts`, `/preview-post`, `/post`, `/post-results`, `/social-setup`
115
+ **Communication:** `/email`, `/checkemail`, `/imessage`
116
+ **Design:** `/generateimage`
117
+ **System:** `/cleanup`, `/garden`, `/search`, `/search-reindex`, `/harness-audit`, `/model-route`, `/update-hq`
118
+ **Company:** `/newcompany`, `/launch-brand`, `/pb-connect`, `/bootcamp-student`, `/personal-interview`
119
+ **Linear:** `/check-linear-acme-recover`, `/{product}-prd`
120
+ **Deploy:** `/pr`
121
+
122
+ ## CLI: `hq mesh` (Work Mesh Live)
123
+
124
+ Presence and per-turn activity are automatic via hooks + `hq mesh daemon`. Manual verbs only: `task-status`, `blocked`, `note`. See `core/knowledge/public/hq-core/work-mesh-live.md` and `core/skills/work-mesh/`.
125
+
126
+ | Command | Use |
127
+ |---------|-----|
128
+ | `hq mesh daemon install\|status\|doctor` | Resident presence + spool flush (replaces pack listen) |
129
+ | `hq mesh context reconcile` (`--observation-file`/`--observation-json`) | Resolve company/project (no `--session`) |
130
+ | `hq mesh context organize\|correct\|untracked` (`--session` / sessionId arg) | Bind, correct, or mark untracked |
131
+ | `hq mesh context default get\|set\|clear` | Device default company |
132
+ | `hq mesh session task-status\|blocked\|note\|flush` (`--session-id`) | Discrete Board signals |
133
+
134
+ ## CLI: `hq files` (vault sharing)
135
+
136
+ Not slash commands — direct CLI surface for HQ vault access control. Skill: `.claude/skills/hq-files/SKILL.md`.
137
+
138
+ | Command | Use |
139
+ |---------|-----|
140
+ | `hq files share <prefix>...` | Browser flow — multi-recipient share-session page (no `--with` flag) |
141
+ | `hq files share <prefix> --no-open` | Browser flow but print URL instead of launching |
142
+ | `hq files share <prefix> --with <email\|grp_*\|@all> --permission <read\|write>` | Direct grant |
143
+ | `hq files unshare <prefix> --with <principal>` | Revoke (idempotent) |
144
+ | `hq files acl <prefix>` | Inspect ACL + your effective permission |
145
+ | `hq access <path-or-query>` | Cannot find or open a file? Reports never-existed / not-synced / no-access (exit 2/0/3), fetches + pins when you have access, otherwise asks the grantor via DM after one confirmation. Skill: `/hq-access`. hq-cli >= 5.109.0 |
146
+
147
+ Share-session URLs are encrypted single-use 15-minute capabilities — never persist them in commits, threads, or logs. See `core/policies/hq-share-session-urls-are-capabilities.md`.
148
+
149
+ ## CLI: `hq db` (vault databases)
150
+
151
+ Local SQLite per company (always) + optional remote Postgres-class on **HQ Team** ($500/mo). Guide: `core/knowledge/public/hq-core/vault-databases.md`. Requires `@indigoai-us/hq-cli` ≥ 5.62.0.
152
+
153
+ | Command | Use |
154
+ |---------|-----|
155
+ | `hq db status --company {co}` | Ensure local `~/.hq/db/{co}/vault.db` (WAL); report schema version |
156
+ | `hq db sql --company {co} -- 'SELECT …'` | Query local DB (read-only default; `--write` for mutations) |
157
+ | `hq db migrate --company {co} --hq-root {HQ}` | Apply `companies/{co}/db/migrations/*.sql` |
158
+ | `hq db provision --company {co}` | Remote binding — **Team plan only** (when control plane live) |
159
+
160
+ Migrations are vault **text**; binary `.db` files stay machine-local (never under `companies/`). Never print connection strings. Local and remote are not auto-replicated in v1.
161
+
162
+ ## CLI: `hq dm` (direct messages)
163
+
164
+ Send a person-to-person notification to a teammate's HQ Desktop App. Skill: `.claude/skills/dm/SKILL.md` (`/dm`).
165
+
166
+ | Command | Use |
167
+ |---------|-----|
168
+ | `hq dm <email\|prs_*> "<message>"` | Plain DM — recipient gets an HQ Desktop App notification |
169
+ | `hq dm <r> "<m>" --prompt "<ctx>"` | Attach agent context — recipient gets a one-click "Copy prompt" action |
170
+ | `hq dm <r> "<m>" --details "<text>"` / `--details-file <path>` | Longer text shown in the recipient's "Open details" window |
171
+ | `hq dm <r> "<m>" --at <iso>` / `--in <30s\|10m\|2h\|1d>` | Schedule delivery (store-and-forward) |
172
+
173
+ Receive-only in the app — sending is session/CLI only. You can only DM someone you share an active company with; DM your own email for a note-to-self/reminder. Never put secrets in a DM (stored server-side).
174
+
175
+ ## Command ↔ Skill Shapes
176
+
177
+ Every command exists as `.claude/commands/{name}.md` (the slash-command entry point) and most have a paired `.claude/skills/{name}/SKILL.md` (the Skill-tool canonical logic). Two valid shapes:
178
+
179
+ **Consolidated (default for new commands)** — `.md` is a ~20-line delegator stub, `SKILL.md` holds the canonical logic. One source of truth, no drift. Converted pairs (Phase 3.1 audit): `search`, `audit-log`, `brainstorm`, `startwork`, `plan`, `handoff`, `learn`, `execute-task`.
180
+
181
+ **Thin-router split (only one)** — `run-project`. The `.md` is the canonical docs/flags/examples source (622 lines). The `SKILL.md` is a ~66-line bash wrapper that execs `core/scripts/run-project.sh`. They stay forked because one is human-facing documentation and the other is a dispatch shim — different jobs, neither redundant.
182
+
183
+ **Intentional exceptions (metadata stubs, no SKILL.md)** — `review`, `investigate`, `retro`, `document-release`, `review-plan`. These are frontmatter-only commands that dispatch prompts; no skill logic to split.
184
+
185
+ **Rule for new commands:** start with the consolidated shape — write the canonical logic in `SKILL.md`, leave `.md` as a stub copying `.claude/commands/startwork.md`'s shape (frontmatter → H1 → intro → `## Steps` → `## After`). Only fork if you have a genuine thin-router reason like `run-project`.
186
+
187
+ ## Knowledge Bases
188
+
189
+ **Public** (`core/knowledge/public/`): Ralph, ai-security-framework, agent-browser, curious-minds, dev-team, hq-core, loom, projects, workers. Optional packs (install via `hq install @indigoai-us/hq-pack-*`) add: design-styles, design-quality, gemini-cli.
190
+
191
+ **Private** (`core/knowledge/private/`): linear
192
+
193
+ **Company-level** (`companies/{co}/knowledge/`): All 14 companies have embedded git repos.
194
+
195
+ ## Policies
196
+
197
+ Standing operational rules per company. Location: `companies/{co}/policies/*.md`
198
+ Cross-cutting rules: `core/policies/*.md` (47 policies)
199
+ Spec: `core/knowledge/public/hq-core/policies-spec.md`. Template: `companies/_template/policies/example-policy.md`