[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M71DZ9E7KYJM3TDAW1JX7W9B":3,"skill-same:01M71DZ9E7KYJM3TDAW1JX7W9B":73},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":38,"linkOnly":39,"markdownContent":40,"markdownBody":41,"frontMatter":42,"refName":44,"commitSha":45,"skillDirectory":46,"forksCount":47,"repositoryHtmlUrl":48,"repositoryHomepageUrl":6,"ownerHtmlUrl":49,"ownerBlogUrl":50,"ownerDescription":51,"updatedAt":52,"install":53,"resources":66},"01M71DZ9E7KYJM3TDAW1JX7W9B","knowledge-pulse",null,"Run a lightweight freshness pass over company knowledge and policies.","indigoai-us\u002Fhq-core","indigoai-us","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F122242446?v=4","01M71DTQ5NGD10GT1Z7E6XKWC5","HQ","01M71DTQ6BKSYYBNC9RAKT3YDK",95,"MIT","https:\u002F\u002Fgithub.com\u002Findigoai-us\u002Fhq-core\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fknowledge-pulse\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37],"pulse","knowledge pulse","knowledge","qmd","stale","grep","policy","core","frontmatter","edit","node","write","read","scripts","run","lock","Bash","company","ls","2026-11-10 10:12:30",false,"---\nname: knowledge-pulse\ndescription: Run a lightweight freshness pass over company knowledge and policies.\nallowed-tools: Read, Write, Edit, Grep, Glob, Bash(qmd:*), Bash(ls:*), Bash(date:*), Bash(core\u002Fscripts\u002Fread-policy-frontmatter.sh:*), Bash(bash core\u002Fscripts\u002Fread-policy-frontmatter.sh:*), Bash(bash core\u002Fscripts\u002Fknowledge-pulse-lock.sh:*), Bash(node core\u002Fscripts\u002Fknowledge-pulse-stale.mjs:*)\n---\n\n# Knowledge Pulse — Background Gardening\n\nLightweight, idempotent gardening pass that runs as a background sub-agent spawned by `startwork`, `brainstorm`, or `plan`. Gardens both **knowledge docs** and **policies** for a single company.\n\n**Never invoked directly.** Always spawned via `spawn_task` by a parent command.\n\n## Input (via spawn prompt)\n\nThe parent command provides these values in the spawn prompt:\n\n| Field | Required | Description |\n|-------|----------|-------------|\n| `company_slug` | Yes | Company slug from manifest |\n| `knowledge_path` | Yes | Resolved path to `companies\u002F{co}\u002Fknowledge\u002F` |\n| `policies_path` | Yes | Resolved path to `companies\u002F{co}\u002Fpolicies\u002F` |\n| `caller` | Yes | `startwork`, `brainstorm`, or `plan` |\n| `qmd_collection` | No | Company's qmd collection for scoped searches |\n| `search_results_summary` | No | Condensed qmd hits from parent (brainstorm\u002Fplan only) |\n| `discovered_facts` | No | New company facts from parent's research (brainstorm\u002Fplan only) |\n| `doc_scout_gaps` | No | Post-implementation doc gaps (plan only) |\n\n## Action Matrix\n\n| Action | startwork | brainstorm | plan |\n|--------|-----------|------------|-----|\n| Knowledge INDEX.md refresh | Yes | Yes | Yes |\n| Tag untagged knowledge docs | Yes | Yes | Yes |\n| Flag stale knowledge (>60d) | Yes | Yes | Yes |\n| company-info.md freshness | Yes | Yes | Yes |\n| Contradiction detection | No | Yes | Yes |\n| Policy frontmatter validation | Yes | Yes | Yes |\n| Stale policy detection | Yes | Yes | Yes |\n| Cross-scope conflict detection | No | Yes | Yes |\n| Orphan policy detection | No | Yes | Yes |\n| Verify policy `when:`\u002F`on:` frontmatter | If changed | If changed | If changed |\n\n## Process\n\n### Step 0: Idempotency Check\n\nCheck for existing report at `workspace\u002Freports\u002Fknowledge-pulse\u002F{company_slug}-{YYYY-MM-DD}.md`.\n\n- If exists from today: **skip entire pulse**. Print \"Pulse already ran for {company_slug} today. Skipping.\" and exit.\n- If not found, atomically claim this company\u002Fdate before reading or editing any knowledge files:\n\n```bash\nbash core\u002Fscripts\u002Fknowledge-pulse-lock.sh claim workspace\u002Freports\u002Fknowledge-pulse\u002F.claims \"{company_slug}\" \"$(date +%F)\"\n```\n\n- If the command prints `already-claimed`: another pulse is running or has already been admitted for this company today. Print \"Pulse already running or ran for {company_slug} today. Skipping.\" and exit without gardening or writing metrics.\n- If it prints `claimed`: proceed. The claim marker is kept for the rest of the date so later invocations cannot produce a second report or duplicate daily metrics. Do not remove it after the pulse finishes.\n\n### Step 1: Check the Company Knowledge Directory\n\nCompany knowledge is always a plain directory synchronized through its company\nvault. Do not inspect it for Git metadata or run Git commands in it.\n\n```bash\nif [ -L \"{knowledge_path}\" ]; then\n  repo_type=\"symlink\"\nelse\n  repo_type=\"company-vault\"\nfi\n```\n\n**If `repo_type` is `symlink`, STOP HERE.** The layout is invalid (policy\n`knowledge-repositories-never-symlink`): skip Steps 2–4 entirely — no INDEX.md\nregeneration, no tagging, no stale-status edits, nothing written through the\nlink. Jump straight to Step 5 to report the migration violation. The\ncompany knowledge path must be materialized manually as a plain real directory\nafter safely preserving its contents and any needed Git history outside the\ncompany folder. Do not use an automatic repository migration for this path.\n\n### Step 2: Knowledge Garden\n\n#### 2a. INDEX.md Refresh\n\n1. Glob `{knowledge_path}\u002F**\u002F*.md` to get actual file list\n2. Read `{knowledge_path}\u002FINDEX.md` (if exists)\n3. Compare: are there files not listed in INDEX, or INDEX entries pointing to missing files?\n4. If drift detected: regenerate INDEX.md per the index-md-spec pattern (hierarchical, grouped by subdirectory)\n5. Track: `index_refreshed = true\u002Ffalse`\n\n#### 2b. Tag Untagged Docs\n\nFor each `.md` file in `{knowledge_path}\u002F` (skip `INDEX.md`, `README.md`):\n\n1. Read first 10 lines — check for YAML frontmatter (`---` delimiters)\n2. If **no frontmatter**: classify per `core\u002Fknowledge\u002Fpublic\u002Fhq-core\u002Fknowledge-ontology.yaml`:\n   - `type`: infer from content (strategy\u002Freference\u002Fguide\u002Fanalysis\u002Fbrand\u002Foverview)\n   - `domain`: infer from content and subdirectory location\n   - `status`: default `draft` for untagged docs\n   - `tags`: extract 3-5 topic keywords from content\n   - `relates_to`: leave empty (vector search for relations is expensive; skip in pulse)\n3. Prepend YAML frontmatter block to the file\n4. Track: `docs_tagged` count\n\n**Cap:** Process at most 20 untagged files per pulse run. If more exist, note remainder in report.\n\n#### 2c. Flag Stale Content\n\nFor each `.md` file in `{knowledge_path}\u002F` (skip `INDEX.md`):\n\n1. Run the deterministic helper for each file, using the resolved company knowledge root and absolute file path:\n   `node core\u002Fscripts\u002Fknowledge-pulse-stale.mjs --knowledge-root \"{knowledge_path}\" --file \"{absolute_file_path}\"`\n2. The helper uses filesystem modification time, not Git history. After more than 60 days it adds `stale_since: YYYY-MM-DD` to supported existing frontmatter. **Preserve every semantic `status` value and all other content. Never replace status with `stale`.**\n3. Count `flagged` results as `stale_flagged`; collect `over_90_days` results for review. `already_flagged` is an unchanged annotation, not another edit. Do not automatically clear annotations merely because an automated edit refreshed mtime.\n4. Leave missing\u002Funsupported frontmatter, symlinks, files outside this company's knowledge root and changed files untouched. Report refused files or helper failures; do not substitute a manual status rewrite.\n\n#### 2d. company-info.md Check\n\n1. Check if `{knowledge_path}\u002Fcompany-info.md` exists\n2. If it exists: check its filesystem modification time; do not use Git history.\n3. Track: `company_info_age_days` (or `null` if missing)\n4. If >90 days stale: flag in report\n5. If `discovered_facts` provided by parent: note in report as \"Potential updates for human review\" (do NOT auto-modify company-info.md — it's high-stakes)\n\n#### 2e. Contradiction Detection (brainstorm\u002Fplan only)\n\n**Skip if caller is `startwork`.**\n\nIf `search_results_summary` provided:\n\n1. For each qmd hit path in the summary, read the file\n2. Compare key facts (pricing, features, architecture claims) against other knowledge docs in the same domain\n3. If contradictions found: log each as `{file_a, file_b, claim_a, claim_b}` in report\n4. Track: `contradictions` count\n\n**This is read-only** — contradictions are logged, never auto-resolved.\n\n### Step 3: Policy Garden\n\n#### 3a. Policy Frontmatter Validation\n\nGlob `{policies_path}\u002F*.md` (skip `example-policy.md`).\n\nFor each policy file:\n\n1. Read first 20 lines — extract YAML frontmatter\n2. Check required fields per policies-spec: `id`, `title`, `when`, `on`, `enforcement`, `version`, `created`, `updated`, `public`\n3. If missing required fields: log in report as \"Policy {filename} missing fields: {list}\"\n4. Track: `policies_invalid` count\n\n**Do NOT auto-fix policy frontmatter** — policy content is high-stakes. Report only.\n\n#### 3b. Stale Policy Detection\n\nFor each policy file:\n\n1. Read the `## Rule` section\n2. Check for references to specific file paths — verify those paths still exist via `ls`\n3. Check for references to repo names — verify against `companies\u002Fmanifest.yaml` repos list\n4. Check for references to worker names — verify against `core\u002Fworkers\u002Fregistry.yaml`\n5. If broken references found: log as \"Policy {filename} references missing {type}: {path\u002Fname}\"\n6. Track: `policies_stale_refs` count\n\n#### 3c. Cross-Scope Conflict Detection (brainstorm\u002Fplan only)\n\n**Skip if caller is `startwork`.**\n\n1. Read company policies from `{policies_path}\u002F`\n2. Collect global policy files except `example-policy.md`, preserve their order, and split the stable file order into consecutive chunks of at most 40 files. For each chunk, run `bash core\u002Fscripts\u002Fread-policy-frontmatter.sh {file1} {file2} ...` once with each path as a separate argument. Keep each call under 30 KB of output. The first output block belongs to the chunk’s first file argument; each later block belongs to the path named by its preceding `# --- policy-file: \u003Cpath> ---` separator.\n3. For each company policy: check if a global policy with similar `trigger` exists\n4. If both are `enforcement: hard` with potentially conflicting rules: log as \"Potential conflict: company {title} vs global {title}\"\n5. Track: `policy_conflicts` count\n\n#### 3d. Orphan Policy Detection (brainstorm\u002Fplan only)\n\n**Skip if caller is `startwork`.**\n\n1. For each company policy with `scope: repo` in frontmatter: verify the referenced repo exists in manifest\n2. For each policy referencing a specific worker: verify the worker exists in registry\n3. If orphaned: log as \"Orphan policy {filename}: references {type} {name} which no longer exists\"\n4. Track: `policies_orphaned` count\n\n#### 3e. Policy Surfacing\n\nNo digest rebuild step exists. Policies surface automatically via the SessionStart trigger hook (`inject-policy-on-trigger.sh`) and the `migrate-policy-triggers.sh` backfill. If a policy was modified in Steps 3a-3d (currently none are — all report-only), just ensure it still carries `when:`\u002F`on:` frontmatter.\n\n### Step 4: Record Changes for Company Vault Sync\n\n**Knowledge changes** (INDEX.md refresh, tagging, stale flags):\n\n- If `repo_type` is `company-vault`, do not run Git commands. Record the changed\n  paths in the pulse report for company vault sync.\n- If `repo_type` is `symlink`, this step is never reached; Step 1 stops before\n  any write and reports the migration violation.\n\n**Policy changes:** Currently all policy actions are report-only (no file modifications). If future versions add policy auto-fixes, commit to HQ git separately.\n\n### Step 5: Write Pulse Report\n\nWrite to `workspace\u002Freports\u002Fknowledge-pulse\u002F{company_slug}-{YYYY-MM-DD}.md`:\n\n```markdown\n# Knowledge Pulse: {company_slug}\n**Date:** {YYYY-MM-DD} | **Triggered by:** {caller} | **Storage:** {repo_type}\n\n## Knowledge Actions\n- INDEX.md: {refreshed — N files added\u002Fremoved | no drift detected}\n- Tagged: {N} untagged docs {(M remaining, capped at 20) if applicable}\n- Stale flags: {N} files marked stale (>60d)\n- company-info.md: {fresh (Nd old) | stale (Nd old) — review needed | not found}\n- Company vault sync: {changed paths ready for sync | no changes}\n\n## Policy Health\n- Validated: {N} policies, {M} with missing frontmatter fields\n- Stale references: {N} policies reference missing paths\u002Frepos\u002Fworkers\n- Cross-scope conflicts: {N} potential conflicts {(skipped — startwork caller)}\n- Orphan policies: {N} reference nonexistent repos\u002Fworkers {(skipped — startwork caller)}\n\n## Contradictions Found\n{table: file_a | file_b | conflicting claims — or \"None\" or \"Skipped (startwork caller)\"}\n\n## Stale Files (>90d)\n{table: file | last modified | age (or \"None\")}\n\n## Invalid Policy Frontmatter\n{table: file | missing fields — or \"None\"}\n\n## Stale Policy References\n{table: file | references | type | status — or \"None\"}\n\n## Discovered Facts (for human review)\n{list from parent's discovered_facts — or \"None provided\"}\n\n## Doc Scout Gaps\n{list from parent's doc_scout_gaps — or \"None provided\" or \"N\u002FA (not prd caller)\"}\n```\n\n### Step 6: Append Health Metrics\n\nAppend one JSON line to `workspace\u002Fmetrics\u002Fknowledge-health.jsonl`:\n\n```json\n{\"timestamp\":\"{ISO8601}\",\"company\":\"{company_slug}\",\"caller\":\"{caller}\",\"repo_type\":\"{repo_type}\",\"index_refreshed\":{bool},\"docs_tagged\":{N},\"stale_flagged\":{N},\"company_info_age_days\":{N|null},\"contradictions\":{N},\"policies_validated\":{N},\"policies_invalid\":{N},\"policies_stale_refs\":{N},\"policy_conflicts\":{N},\"policies_orphaned\":{N}}\n```\n\n## Rules\n\n- **Idempotent** — one pulse per company per day. Second invocation skips entirely\n- **Non-destructive** — never delete, archive, or move files. Only: add frontmatter, update status field, regenerate INDEX.md\n- **Policy changes are report-only** — never auto-modify policy content. Frontmatter validation and stale detection produce reports, not fixes\n- **company-info.md is hands-off** — only report age and discovered facts. Never auto-update\n- **Cap tagging at 20 files** — prevents runaway in large knowledge bases\n- **Company storage:** company knowledge is a plain directory synced through its vault. Do not inspect it for Git metadata or run Git commands there. Report symlinks as migration violations and never write through them.\n- **Company isolation** — only garden the specified company's knowledge and policies. Never cross-company\n- **Background execution** — this skill runs detached from the parent command. No user interaction, no AskUserQuestion, no plan mode\n- **Failures:** if qmd is unavailable, skip contradiction detection. If filesystem timestamps cannot be read, skip stale detection and report the limitation. Always produce a report, including when some checks fail.\n- **No INDEX.md reads during startwork** — startwork's rule \"NEVER read company knowledge dirs\" applies to the main command, not this background agent. The pulse agent operates independently\n","# Knowledge Pulse — Background Gardening\n\nLightweight, idempotent gardening pass that runs as a background sub-agent spawned by `startwork`, `brainstorm`, or `plan`. Gardens both **knowledge docs** and **policies** for a single company.\n\n**Never invoked directly.** Always spawned via `spawn_task` by a parent command.\n\n## Input (via spawn prompt)\n\nThe parent command provides these values in the spawn prompt:\n\n| Field | Required | Description |\n|-------|----------|-------------|\n| `company_slug` | Yes | Company slug from manifest |\n| `knowledge_path` | Yes | Resolved path to `companies\u002F{co}\u002Fknowledge\u002F` |\n| `policies_path` | Yes | Resolved path to `companies\u002F{co}\u002Fpolicies\u002F` |\n| `caller` | Yes | `startwork`, `brainstorm`, or `plan` |\n| `qmd_collection` | No | Company's qmd collection for scoped searches |\n| `search_results_summary` | No | Condensed qmd hits from parent (brainstorm\u002Fplan only) |\n| `discovered_facts` | No | New company facts from parent's research (brainstorm\u002Fplan only) |\n| `doc_scout_gaps` | No | Post-implementation doc gaps (plan only) |\n\n## Action Matrix\n\n| Action | startwork | brainstorm | plan |\n|--------|-----------|------------|-----|\n| Knowledge INDEX.md refresh | Yes | Yes | Yes |\n| Tag untagged knowledge docs | Yes | Yes | Yes |\n| Flag stale knowledge (>60d) | Yes | Yes | Yes |\n| company-info.md freshness | Yes | Yes | Yes |\n| Contradiction detection | No | Yes | Yes |\n| Policy frontmatter validation | Yes | Yes | Yes |\n| Stale policy detection | Yes | Yes | Yes |\n| Cross-scope conflict detection | No | Yes | Yes |\n| Orphan policy detection | No | Yes | Yes |\n| Verify policy `when:`\u002F`on:` frontmatter | If changed | If changed | If changed |\n\n## Process\n\n### Step 0: Idempotency Check\n\nCheck for existing report at `workspace\u002Freports\u002Fknowledge-pulse\u002F{company_slug}-{YYYY-MM-DD}.md`.\n\n- If exists from today: **skip entire pulse**. Print \"Pulse already ran for {company_slug} today. Skipping.\" and exit.\n- If not found, atomically claim this company\u002Fdate before reading or editing any knowledge files:\n\n```bash\nbash core\u002Fscripts\u002Fknowledge-pulse-lock.sh claim workspace\u002Freports\u002Fknowledge-pulse\u002F.claims \"{company_slug}\" \"$(date +%F)\"\n```\n\n- If the command prints `already-claimed`: another pulse is running or has already been admitted for this company today. Print \"Pulse already running or ran for {company_slug} today. Skipping.\" and exit without gardening or writing metrics.\n- If it prints `claimed`: proceed. The claim marker is kept for the rest of the date so later invocations cannot produce a second report or duplicate daily metrics. Do not remove it after the pulse finishes.\n\n### Step 1: Check the Company Knowledge Directory\n\nCompany knowledge is always a plain directory synchronized through its company\nvault. Do not inspect it for Git metadata or run Git commands in it.\n\n```bash\nif [ -L \"{knowledge_path}\" ]; then\n  repo_type=\"symlink\"\nelse\n  repo_type=\"company-vault\"\nfi\n```\n\n**If `repo_type` is `symlink`, STOP HERE.** The layout is invalid (policy\n`knowledge-repositories-never-symlink`): skip Steps 2–4 entirely — no INDEX.md\nregeneration, no tagging, no stale-status edits, nothing written through the\nlink. Jump straight to Step 5 to report the migration violation. The\ncompany knowledge path must be materialized manually as a plain real directory\nafter safely preserving its contents and any needed Git history outside the\ncompany folder. Do not use an automatic repository migration for this path.\n\n### Step 2: Knowledge Garden\n\n#### 2a. INDEX.md Refresh\n\n1. Glob `{knowledge_path}\u002F**\u002F*.md` to get actual file list\n2. Read `{knowledge_path}\u002FINDEX.md` (if exists)\n3. Compare: are there files not listed in INDEX, or INDEX entries pointing to missing files?\n4. If drift detected: regenerate INDEX.md per the index-md-spec pattern (hierarchical, grouped by subdirectory)\n5. Track: `index_refreshed = true\u002Ffalse`\n\n#### 2b. Tag Untagged Docs\n\nFor each `.md` file in `{knowledge_path}\u002F` (skip `INDEX.md`, `README.md`):\n\n1. Read first 10 lines — check for YAML frontmatter (`---` delimiters)\n2. If **no frontmatter**: classify per `core\u002Fknowledge\u002Fpublic\u002Fhq-core\u002Fknowledge-ontology.yaml`:\n   - `type`: infer from content (strategy\u002Freference\u002Fguide\u002Fanalysis\u002Fbrand\u002Foverview)\n   - `domain`: infer from content and subdirectory location\n   - `status`: default `draft` for untagged docs\n   - `tags`: extract 3-5 topic keywords from content\n   - `relates_to`: leave empty (vector search for relations is expensive; skip in pulse)\n3. Prepend YAML frontmatter block to the file\n4. Track: `docs_tagged` count\n\n**Cap:** Process at most 20 untagged files per pulse run. If more exist, note remainder in report.\n\n#### 2c. Flag Stale Content\n\nFor each `.md` file in `{knowledge_path}\u002F` (skip `INDEX.md`):\n\n1. Run the deterministic helper for each file, using the resolved company knowledge root and absolute file path:\n   `node core\u002Fscripts\u002Fknowledge-pulse-stale.mjs --knowledge-root \"{knowledge_path}\" --file \"{absolute_file_path}\"`\n2. The helper uses filesystem modification time, not Git history. After more than 60 days it adds `stale_since: YYYY-MM-DD` to supported existing frontmatter. **Preserve every semantic `status` value and all other content. Never replace status with `stale`.**\n3. Count `flagged` results as `stale_flagged`; collect `over_90_days` results for review. `already_flagged` is an unchanged annotation, not another edit. Do not automatically clear annotations merely because an automated edit refreshed mtime.\n4. Leave missing\u002Funsupported frontmatter, symlinks, files outside this company's knowledge root and changed files untouched. Report refused files or helper failures; do not substitute a manual status rewrite.\n\n#### 2d. company-info.md Check\n\n1. Check if `{knowledge_path}\u002Fcompany-info.md` exists\n2. If it exists: check its filesystem modification time; do not use Git history.\n3. Track: `company_info_age_days` (or `null` if missing)\n4. If >90 days stale: flag in report\n5. If `discovered_facts` provided by parent: note in report as \"Potential updates for human review\" (do NOT auto-modify company-info.md — it's high-stakes)\n\n#### 2e. Contradiction Detection (brainstorm\u002Fplan only)\n\n**Skip if caller is `startwork`.**\n\nIf `search_results_summary` provided:\n\n1. For each qmd hit path in the summary, read the file\n2. Compare key facts (pricing, features, architecture claims) against other knowledge docs in the same domain\n3. If contradictions found: log each as `{file_a, file_b, claim_a, claim_b}` in report\n4. Track: `contradictions` count\n\n**This is read-only** — contradictions are logged, never auto-resolved.\n\n### Step 3: Policy Garden\n\n#### 3a. Policy Frontmatter Validation\n\nGlob `{policies_path}\u002F*.md` (skip `example-policy.md`).\n\nFor each policy file:\n\n1. Read first 20 lines — extract YAML frontmatter\n2. Check required fields per policies-spec: `id`, `title`, `when`, `on`, `enforcement`, `version`, `created`, `updated`, `public`\n3. If missing required fields: log in report as \"Policy {filename} missing fields: {list}\"\n4. Track: `policies_invalid` count\n\n**Do NOT auto-fix policy frontmatter** — policy content is high-stakes. Report only.\n\n#### 3b. Stale Policy Detection\n\nFor each policy file:\n\n1. Read the `## Rule` section\n2. Check for references to specific file paths — verify those paths still exist via `ls`\n3. Check for references to repo names — verify against `companies\u002Fmanifest.yaml` repos list\n4. Check for references to worker names — verify against `core\u002Fworkers\u002Fregistry.yaml`\n5. If broken references found: log as \"Policy {filename} references missing {type}: {path\u002Fname}\"\n6. Track: `policies_stale_refs` count\n\n#### 3c. Cross-Scope Conflict Detection (brainstorm\u002Fplan only)\n\n**Skip if caller is `startwork`.**\n\n1. Read company policies from `{policies_path}\u002F`\n2. Collect global policy files except `example-policy.md`, preserve their order, and split the stable file order into consecutive chunks of at most 40 files. For each chunk, run `bash core\u002Fscripts\u002Fread-policy-frontmatter.sh {file1} {file2} ...` once with each path as a separate argument. Keep each call under 30 KB of output. The first output block belongs to the chunk’s first file argument; each later block belongs to the path named by its preceding `# --- policy-file: \u003Cpath> ---` separator.\n3. For each company policy: check if a global policy with similar `trigger` exists\n4. If both are `enforcement: hard` with potentially conflicting rules: log as \"Potential conflict: company {title} vs global {title}\"\n5. Track: `policy_conflicts` count\n\n#### 3d. Orphan Policy Detection (brainstorm\u002Fplan only)\n\n**Skip if caller is `startwork`.**\n\n1. For each company policy with `scope: repo` in frontmatter: verify the referenced repo exists in manifest\n2. For each policy referencing a specific worker: verify the worker exists in registry\n3. If orphaned: log as \"Orphan policy {filename}: references {type} {name} which no longer exists\"\n4. Track: `policies_orphaned` count\n\n#### 3e. Policy Surfacing\n\nNo digest rebuild step exists. Policies surface automatically via the SessionStart trigger hook (`inject-policy-on-trigger.sh`) and the `migrate-policy-triggers.sh` backfill. If a policy was modified in Steps 3a-3d (currently none are — all report-only), just ensure it still carries `when:`\u002F`on:` frontmatter.\n\n### Step 4: Record Changes for Company Vault Sync\n\n**Knowledge changes** (INDEX.md refresh, tagging, stale flags):\n\n- If `repo_type` is `company-vault`, do not run Git commands. Record the changed\n  paths in the pulse report for company vault sync.\n- If `repo_type` is `symlink`, this step is never reached; Step 1 stops before\n  any write and reports the migration violation.\n\n**Policy changes:** Currently all policy actions are report-only (no file modifications). If future versions add policy auto-fixes, commit to HQ git separately.\n\n### Step 5: Write Pulse Report\n\nWrite to `workspace\u002Freports\u002Fknowledge-pulse\u002F{company_slug}-{YYYY-MM-DD}.md`:\n\n```markdown\n# Knowledge Pulse: {company_slug}\n**Date:** {YYYY-MM-DD} | **Triggered by:** {caller} | **Storage:** {repo_type}\n\n## Knowledge Actions\n- INDEX.md: {refreshed — N files added\u002Fremoved | no drift detected}\n- Tagged: {N} untagged docs {(M remaining, capped at 20) if applicable}\n- Stale flags: {N} files marked stale (>60d)\n- company-info.md: {fresh (Nd old) | stale (Nd old) — review needed | not found}\n- Company vault sync: {changed paths ready for sync | no changes}\n\n## Policy Health\n- Validated: {N} policies, {M} with missing frontmatter fields\n- Stale references: {N} policies reference missing paths\u002Frepos\u002Fworkers\n- Cross-scope conflicts: {N} potential conflicts {(skipped — startwork caller)}\n- Orphan policies: {N} reference nonexistent repos\u002Fworkers {(skipped — startwork caller)}\n\n## Contradictions Found\n{table: file_a | file_b | conflicting claims — or \"None\" or \"Skipped (startwork caller)\"}\n\n## Stale Files (>90d)\n{table: file | last modified | age (or \"None\")}\n\n## Invalid Policy Frontmatter\n{table: file | missing fields — or \"None\"}\n\n## Stale Policy References\n{table: file | references | type | status — or \"None\"}\n\n## Discovered Facts (for human review)\n{list from parent's discovered_facts — or \"None provided\"}\n\n## Doc Scout Gaps\n{list from parent's doc_scout_gaps — or \"None provided\" or \"N\u002FA (not prd caller)\"}\n```\n\n### Step 6: Append Health Metrics\n\nAppend one JSON line to `workspace\u002Fmetrics\u002Fknowledge-health.jsonl`:\n\n```json\n{\"timestamp\":\"{ISO8601}\",\"company\":\"{company_slug}\",\"caller\":\"{caller}\",\"repo_type\":\"{repo_type}\",\"index_refreshed\":{bool},\"docs_tagged\":{N},\"stale_flagged\":{N},\"company_info_age_days\":{N|null},\"contradictions\":{N},\"policies_validated\":{N},\"policies_invalid\":{N},\"policies_stale_refs\":{N},\"policy_conflicts\":{N},\"policies_orphaned\":{N}}\n```\n\n## Rules\n\n- **Idempotent** — one pulse per company per day. Second invocation skips entirely\n- **Non-destructive** — never delete, archive, or move files. Only: add frontmatter, update status field, regenerate INDEX.md\n- **Policy changes are report-only** — never auto-modify policy content. Frontmatter validation and stale detection produce reports, not fixes\n- **company-info.md is hands-off** — only report age and discovered facts. Never auto-update\n- **Cap tagging at 20 files** — prevents runaway in large knowledge bases\n- **Company storage:** company knowledge is a plain directory synced through its vault. Do not inspect it for Git metadata or run Git commands there. Report symlinks as migration violations and never write through them.\n- **Company isolation** — only garden the specified company's knowledge and policies. Never cross-company\n- **Background execution** — this skill runs detached from the parent command. No user interaction, no AskUserQuestion, no plan mode\n- **Failures:** if qmd is unavailable, skip contradiction detection. If filesystem timestamps cannot be read, skip stale detection and report the limitation. Always produce a report, including when some checks fail.\n- **No INDEX.md reads during startwork** — startwork's rule \"NEVER read company knowledge dirs\" applies to the main command, not this background agent. The pulse agent operates independently\n",{"name":5,"description":7,"allowed-tools":43},"Read, Write, Edit, Grep, Glob, Bash(qmd:*), Bash(ls:*), Bash(date:*), Bash(core\u002Fscripts\u002Fread-policy-frontmatter.sh:*), Bash(bash core\u002Fscripts\u002Fread-policy-frontmatter.sh:*), Bash(bash core\u002Fscripts\u002Fknowledge-pulse-lock.sh:*), Bash(node core\u002Fscripts\u002Fknowledge-pulse-stale.mjs:*)","main","205cf61728a27ef15e9153aa38df5856fc8d82f5",".claude\u002Fskills\u002Fknowledge-pulse",18,"https:\u002F\u002Fgithub.com\u002Findigoai-us\u002Fhq-core","https:\u002F\u002Fgithub.com\u002Findigoai-us","https:\u002F\u002Fhqforwork.com\u002F","The AI Context Layer for Teams","2026-11-12 06:53:38",{"source":8,"skillName":5,"commands":54,"prompt":64,"zipAvailable":65},[55,58,61],{"tool":56,"command":57},"npx","npx skills add indigoai-us\u002Fhq-core --skill knowledge-pulse",{"tool":59,"command":60},"bunx","bunx skills add indigoai-us\u002Fhq-core --skill knowledge-pulse",{"tool":62,"command":63},"pnpm","pnpm dlx skills add indigoai-us\u002Fhq-core --skill knowledge-pulse","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Findigoai-us\u002Fhq-core\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fknowledge-pulse\u002FSKILL.md",true,[67],{"path":68,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":71,"sourceHtmlUrl":72},"agents\u002Fopenai.yaml","REFERENCE","参考文档",123,"https:\u002F\u002Fgithub.com\u002Findigoai-us\u002Fhq-core\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fknowledge-pulse\u002Fagents\u002Fopenai.yaml",[74,82,89,96,103,110],{"skillNo":75,"name":76,"nameZh":6,"description":77,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":78,"categories":79,"keywords":80,"publishedAt":81},"01M73NTNKZ3T2KJNDP2ZF23645","job","Deprecated alias for \u002Fschedule — Outpost recurring agent jobs. Prefer \u002Fschedule.","https:\u002F\u002Fgithub.com\u002Findigoai-us\u002Fhq-core\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fjob\u002FSKILL.md",[],[],"2026-11-11 15:11:14",{"skillNo":83,"name":84,"nameZh":6,"description":85,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":86,"categories":87,"keywords":88,"publishedAt":81},"01M73NTE0H9DQTT6DNHDKRWTXW","import-claude","Deprecated alias for \u002Fimport-context — bootstrap HQ from your prior AI footprint (Claude Code, Codex, Grok, claude.ai history plus on-disk artifacts).","https:\u002F\u002Fgithub.com\u002Findigoai-us\u002Fhq-core\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fimport-claude\u002FSKILL.md",[],[],{"skillNo":90,"name":91,"nameZh":6,"description":92,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":93,"categories":94,"keywords":95,"publishedAt":81},"01M73NT67433KKX96CCJWDQQ0X","hq-whoami","Show current HQ Cognito identity and session expiry.","https:\u002F\u002Fgithub.com\u002Findigoai-us\u002Fhq-core\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fhq-whoami\u002FSKILL.md",[],[],{"skillNo":97,"name":98,"nameZh":6,"description":99,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":100,"categories":101,"keywords":102,"publishedAt":81},"01M73NT17SVXZV2QPT14C2RPJP","hq-share","Share HQ vault paths through single-use links or direct ACL grants.","https:\u002F\u002Fgithub.com\u002Findigoai-us\u002Fhq-core\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fhq-share\u002FSKILL.md",[],[],{"skillNo":104,"name":105,"nameZh":6,"description":106,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":107,"categories":108,"keywords":109,"publishedAt":81},"01M73NSXYFMD7EHGT8TFDZA3C8","hq-secrets","Use HQ CLI secrets safely through env injection or one-off exec.","https:\u002F\u002Fgithub.com\u002Findigoai-us\u002Fhq-core\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fhq-secrets\u002FSKILL.md",[],[],{"skillNo":111,"name":112,"nameZh":6,"description":113,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":114,"categories":115,"keywords":116,"publishedAt":81},"01M73NSWCXJK29Q8CNG8AS3ZZQ","hq-logout","Sign out of HQ Cognito and clear local tokens.","https:\u002F\u002Fgithub.com\u002Findigoai-us\u002Fhq-core\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fhq-logout\u002FSKILL.md",[],[]]