Generated banner for business-context-os
Generated logo for business-context-os

business-context-os

LLM wiki kit

First committed by walm00

Published in walm00/business-context-os. Publisher page

22 GitHub stars

What it is

CLEAR Context OS is the maintenance layer your second brain never had: ownership boundaries enforced mechanically, staleness surfaced on a schedule, drift propagated across linked docs, a dispatcher that learns from your clicks. One source of truth per topic. Searchable. Task-aware.
— the description by walm00

AutoGineer overview, from the brain’s own files

CLEAR Context OS is a framework designed to solve the problem of silent context degradation in AI agents. By implementing a structured methodology called CLEAR (Contextual Ownership, Linking, Elimination, Alignment, Refinement), it provides a maintenance layer that manages knowledge through automated scheduling, ownership enforcement, and drift detection. It organizes information into specific zones—such as canonical data, wiki-based derivatives, and verbatim evidence—ensuring that agents always operate on the most accurate, source-of-truth-ranked information. The system includes a dispatcher for scheduled maintenance, a local dashboard for monitoring, and integration with Claude Code to facilitate onboarding and task-aware context retrieval.

How it works

Memory model: LLM wiki

AutoGineer overview, from the brain’s own files

The system organizes information into a folder hierarchy where the path itself acts as a trust signal for the LLM. It uses a dispatcher to run scheduled maintenance jobs that check for staleness, propagate updates across linked documents, and audit content health. New information is ingested through a routing process that places content into specific zones: canonical data for facts, wiki pages for operational knowledge, and collections for legal evidence. The system learns from user interactions to suggest fixes and uses frontmatter metadata to allow agents to filter and retrieve information efficiently without full-text scanning.

Folders
FolderRoleFiles
.claudeagent-config193
.githubagent-config6
docsdocs68

The agent reads

The agent writes

Requirements

Works with: Claude Code, OpenCode

Set it up

  1. This brain runs code automatically: 5 hooks (claude-code), 1 script. Review .claude/settings.json, install.sh before opening the folder in Claude Code. No step below turns a hook on for you.

    • .claude/settings.json: bash "$CLAUDE_PROJECT_DIR/.claude/hooks/auto_save_session.sh"
    • .claude/settings.json: bash "$CLAUDE_PROJECT_DIR/.claude/hooks/precompact_save.sh"
    • .claude/settings.json: "$CLAUDE_PROJECT_DIR/.claude/bin/python3" "$CLAUDE_PROJECT_DIR/.claude/hooks/post_edit_frontmatter_check.py"
    • .claude/settings.json: "$CLAUDE_PROJECT_DIR/.claude/bin/python3" "$CLAUDE_PROJECT_DIR/.claude/hooks/post_edit_frontmatter_check.py"
    • .claude/settings.json: "$CLAUDE_PROJECT_DIR/.claude/bin/python3" "$CLAUDE_PROJECT_DIR/.claude/hooks/post_commit_context_check.py"
    • install.sh: sh install.sh
  2. Clone the repository at the commit AutoGineer scanned:

    git clone https://github.com/walm00/business-context-os.git && cd business-context-os && git checkout 463568372f31f24fa6c01121c38f989845ca7c84
  3. Claude Code reads CLAUDE.md from this folder automatically.

  4. cd business-context-os && claude

  5. AutoGineer scanned these files at commit 4635683.

  6. First committed by walm00. Published in walm00/business-context-os. Licence: MIT License.

Usage

AutoGineer overview, from the brain’s own files

  • Automating the maintenance of project documentation and SOPs.
  • Providing AI agents with a reliable, freshness-aware knowledge base.
  • Managing ownership boundaries across large, multi-topic documentation sets.
  • Syncing and auditing context across linked documents to prevent drift.
  • Generating daily digests of system health and pending maintenance tasks.
“Install BCOS from https://github.com/walm00/business-context-os and walk me through onboarding.”
Claude clones the repository, sets up the environment, and guides the user through an interactive onboarding process to configure the context architecture.
“/context bundle market-report:write”
The agent retrieves a curated, freshness-aware package of context specifically relevant to writing a market report.
“Run the audit twice a week.”
The dispatcher updates the maintenance schedule to perform an audit of the knowledge base on a bi-weekly cadence.
“/wiki run https://stripe.com/docs/api”
The system fetches the URL, summarizes the content, and creates a cited wiki entry within the knowledge base.

Documentation by walm00

<p align="center"> <h1 align="center">CLEAR Context OS</h1> <p align="center"> <strong>Knowledge that maintains itself —</strong><br> so your AI doesn't act on what was true last month. </p> <p align="center"> <a href="#install">Install</a> &nbsp;·&nbsp; <a href="#what-it-does">What it does</a> &nbsp;·&nbsp; <a href="#the-wiki-zone">Wiki zone</a> &nbsp;·&nbsp; <a href="#what-ships">What ships</a> &nbsp;·&nbsp; <a href="docs/_bcos-framework/guides/getting-started.md">Getting Started</a> </p> <p align="center"> <img src="https://img.shields.io/badge/claude_code-ready-blueviolet" alt="Claude Code"> <img src="https://img.shields.io/badge/methodology-CLEAR-green" alt="CLEAR Methodology"> <img src="https://img.shields.io/badge/install-one_command-success" alt="One-command install"> <img src="https://img.shields.io/badge/skills-17-blue" alt="17 skills"> <img src="https://img.shields.io/badge/maintenance_jobs-12-orange" alt="12 maintenance jobs"> <img src="https://img.shields.io/badge/license-MIT-lightgrey" alt="MIT"> </p> </p>


Your AI had perfect context — two weeks ago. Then your strategy shifted, three meetings redefined priorities, and the docs you wrote on Monday are wrong by Friday. CLEAR Context OS is the maintenance layer your second brain never had: ownership boundaries enforced mechanically, staleness surfaced on a schedule, drift propagated across linked docs, a dispatcher that learns from your clicks. One source of truth per topic. Searchable. Task-aware. Never silently stale.


Install

Easiest — let Claude do it. Open Claude Code in any directory and paste:

"Install BCOS from https://github.com/walm00/business-context-os and walk me through onboarding."

Claude clones the repo, picks the right install path for your platform (Windows/macOS/Linux), runs setup, and steps straight into onboarding. No prereq checks to debug — if something's missing, Claude resolves it interactively.

Or manually, two commands:

curl -fsSL https://raw.githubusercontent.com/walm00/business-context-os/main/install.sh -o /tmp/bcos-install.sh
bash /tmp/bcos-install.sh

(Requires bash, curl, and tar on PATH — fine on macOS/Linux and on Windows under WSL or Git Bash. Two steps instead of a single bash <(curl …) pipe so Claude Code's permission gate auto-approves both commands — you don't need to drop out to a terminal.)

Drop anything you already have — SOPs, brand docs, meeting notes, exports — into docs/_inbox/ (skip if you're starting fresh). Then open Claude Code in that repo and say:

"Launch BCOS onboarding."

That's the only prompt you need. Onboarding inspects your inbox, scans the rest of the repo, asks one Q&A round, and proposes the architecture for review. Works the same whether the repo is fresh or already full of context.


From zero to running

  INSTALL  →  DISCOVER  →  ALIGN  →  SCHEDULE  →  RUNNING
#StepWhat happens
1InstallOne bash line drops the framework into any repo
2DiscoverClaude scans your repo + any MCP you've connected (Drive, Notion, Slack, Gmail, your CRM — whatever's wired in) for existing context, plus anything you've dropped into docs/_inbox/
3AlignOne Q&A round — project type, key sources, ownership boundaries. Architecture drafted for your review
4SchedulePick maintenance cadence in plain English: "audit twice a week", "dispatcher at 08:30", "deep daydream off"
5RunningDaily digest. Local dashboard. /context bundle <task> ready. Context compounds from here — the system maintains itself.

Simple, guided, automatic. Claude walks you through each step — you review, you decide. Nothing deleted along the way — originals preserved or archived, never silently overwritten.


What it does

Stops context rot in three ways:

What it does
OrganizeEvery doc declares what it owns. CLEAR boundaries prevent the same fact living in 5 places.
MaintainScheduled jobs check freshness, surface stale docs, propagate updates across linked content.
Use/context search and /context bundle <task> give Claude curated, freshness-aware, source-of-truth-ranked context for the job at hand.

The folder tells the LLM what to trust. Claude reads the path before the content: docs/*.md = canonical, _planned/ = not yet real, _archive/ = history, _inbox/ = unprocessed, _collections/ = verbatim evidence, _wiki/ = explanatory. The hierarchy is the trust signal — fewer tokens spent re-deciding, no chance of treating an archived draft as today's truth.

docs/
├── *.md                  ← canonical data points (one source of truth per topic)
├── document-index.md     ← auto-generated TOC
├── current-state.md      ← what's true right now + what changed recently
├── table-of-context.md   ← high-level cluster map for orientation
├── _inbox/               ← drop zone — Claude triages on demand
├── _planned/             ← polished ideas, not yet real
├── _archive/             ← superseded — kept, not deleted
├── _collections/         ← verbatim evidence (invoices, contracts, transcripts)
│   └── <type>/_manifest.md   (each collection has a manifest)
├── _wiki/                ← derivative knowledge (how-tos, source summaries)
│   ├── pages/            ← user-authored explainers
│   ├── source-summary/   ← external captures with citation banners
│   ├── raw/              ← original artifacts (PDFs, HTML)
│   └── queue.md          ← URLs awaiting fetch
└── _bcos-framework/      ← framework docs — never user content
    ├── architecture/     ← 12 zone + system architecture docs
    ├── methodology/      ← 5 CLEAR + ownership + standards docs
    ├── patterns/         ← 8 project-type starting templates
    └── templates/        ← 15 frontmatter / schema / starter files

The wiki zone

Inspired by Karpathy's LLM Wiki approach — give the LLM a wiki of your knowledge, the way you'd brief a smart new hire.

Save anything to the wiki, from anywhere:

/wiki run https://stripe.com/docs/api          ← fetch a URL, summarize, cite
/wiki create from /Users/me/Downloads/spec.pdf ← extract a PDF, link to the binary
/wiki promote docs/_inbox/meeting-notes.md     ← turn an inbox capture into a wiki page

The wiki holds how-tos, runbooks, glossaries, source summaries, post-mortems, decision logs — derivative knowledge that explains and supports your canonical data points. Every page cites what it builds on. Stale pages surface automatically when their sources advance.

Wiki content is searchable alongside the rest of your context:

/context search "stripe billing"       ← cross-zone search, ranked by source-of-truth
/context bundle market-report:write    ← curated bundle for a specific task

The dashboard

A local cockpit at http://127.0.0.1:8091 that shows your system at a glance — no third-party services, no telemetry, no logins.

Image: BCOS dashboard cockpit — knowledge system status, things waiting on you, maintenance routine

python .claude/scripts/bcos-dashboard/run.py
SurfaceWhat you see
CockpitOne-line status (healthy / N waiting / heads-up). Per-job dot strip for every maintenance job (core BCOS + wiki zone).
Update"Run full sync" button → update.py + CLAUDE.md drift review + auto-commit + push, with a live log drawer.
Schedules (/settings/schedules)Per-job preset buttons (daily, mon_wed_fri, weekly_mon, off) + the global auto-commit toggle + auto-fix whitelist. Saves directly to schedule-config.json.
Run history (/settings/runs)Last 20 dispatcher runs with filter chips (job / verdict / trigger).
File health (/settings/files)Frontmatter / cross-reference / staleness findings with one-click fixes.

The dashboard is read-mostly: data flows from the dispatcher's diary, the schedule config, and the canonical context index. Writes (mark-done, schedule preset, auto-commit toggle, file fix) go through dedicated POST endpoints.


Requirements

  • Claude Code (desktop app, CLI, or web)

  • Python 3.8+ on PATH

  • bash (default macOS bash 3.2 is fine)


Updating

python .claude/scripts/update.py

Refreshes framework files only — skills, hooks, scripts, templates. Your docs/ and .private/ are never touched.


Maintenance

One scheduled task per repo. The dispatcher reads schedule-config.json, runs the jobs due today, writes one consolidated digest at docs/_inbox/daily-digest.md, and surfaces findings as one-click cards in the dashboard.

Image: BCOS maintenance schedule dispatcher — daily, weekly, monthly jobs flowing into the daily digest and dashboard cards

You can tune any of it in plain English:

"Run the audit twice a week." · "Move dispatcher to 08:30." · "Turn off deep daydream."

The system learns from your clicks. After three consistent uses of the same fix, the dashboard pre-selects it as a "✨ suggested" action — you accept or reject. Reversals trigger an automatic safety brake.


CLEAR — the methodology

Five principles, one rule each:

  • C — Contextual Ownership · one document owns each topic. No duplicates.

  • L — Linking · reference sources; don't copy them.

  • E — Elimination · consolidate; don't keep two versions.

  • A — Alignment · context that doesn't support decisions doesn't belong.

  • R — Refinement · structured maintenance, not ad-hoc fixes.

The whole framework is the mechanical implementation of these five rules.


What ships

Everything below installs as one repo drop-in. No third-party services, no logins, no telemetry — all state lives in your .claude/ and docs/ folders.

LayerCountExamples
Skills (chat-invokable via slash command)17clear-planner · bcos-wiki · context-routing · context-audit · context-ingest · daydream · learning · schedule-tune · lessons-consolidate · ecosystem-manager
Sub-agents (delegated bounded tasks)3wiki-fetch · explore · plus one optional
Scripts (mechanical Python)46lifecycle_sweep · run_wiki_* (5) · cmd_wiki_* (7) · auto_fix_audit · bcos_inventory · digest_sidecar · record_resolution
Hooks (auto-validation on edit)4post-edit frontmatter check · post-commit context check · pre-compact save · auto-save session
Maintenance jobs (scheduled, one dispatcher)12index-health · audit-inbox · daydream-lessons · daydream-deep · architecture-review · auto-fix-audit · lifecycle-sweep · wiki-stale-propagation · wiki-source-refresh · wiki-graveyard · wiki-coverage-audit · wiki-canonical-drift
Auto-fix IDs (silent dispatcher fixes)12missing-last-updated · eof-newline · frontmatter-field-order · wiki-mark-queue-ingested · wiki-archive-expired-post-mortem
Architecture docs12wiki-zone.md · lifecycle-routing.md · typed-events.md · context-zones.md · content-routing.md · wiki-headless-scripts.md
Methodology docs5CLEAR principles · context architecture · decision framework · document standards · ownership specification
Project patterns (starting templates by project type)8client-project · gtm · marketing · operational · product-development · product-service · internal-tool-app · internal-tool-automation
Templates (frontmatter, schema, starters)15data-point · cluster · current-state · table-of-context · wiki-schema · wiki-config · session-diary-starter

Every script and skill is documented at the source. Every job has a reference doc under .claude/skills/schedule-dispatcher/references/job-*.md. Every typed-event finding maps to a renderer in the dashboard cockpit. Adding a new check means dropping a cmd_*.py or run_*.py, registering it in one map, and the dashboard picks it up.


Contributing

Contributions welcome — open an issue or submit a PR targeting the dev branch. CI runs frontmatter, reference, and ecosystem-integration checks on every PR.

The fastest contribution path is lessons learned. As you use the system it captures insights; if you find one universal, contribute it back.


Origin

Built by Guntis Coders after two years of operating context systems in production. The CLEAR methodology emerged from a practical problem: AI context degrades silently, and no amount of one-time documentation prevents it. The solution required a system — ownership boundaries, automated maintenance, self-learning, and structured reflection.

Background: What is the Table of Contexts and why does it matter.


License

MIT

.claude/scripts/context_bundle.py

Shown as plain text.

#!/usr/bin/env python3
"""
Task-driven cross-zone bundle resolver (P5).

Reads a task profile from `_context.task-profiles.yml.tmpl` (or per-repo
override) and resolves a structured bundle envelope from
`.claude/quality/context-index.json`. The envelope tells the calling agent
what context exists for the declared task, with freshness verdicts,
source-of-truth conflicts, missing perspectives, and traversal hops.

Mechanical-first (D-10 strict). The default path is pure Python: pattern
matching, deterministic ranking, graph walk over typed edges, freshness
thresholding, structured-field conflict detection. The only LLM-touching
paths are explicit opt-in flags:
  --resolve-conflicts  -> LLM resolves unresolved source-of-truth conflicts
  --verify-coverage    -> LLM verifies prose-perspective coverage

Both raise `LLMEscalationNotImplementedError` when invoked without
`--dry-run`, until the LLM client wiring lands. `--dry-run` records the
opt-in in `escalations` without firing.

Output envelope:
{
  "profile-id": str,
  "generated-at": str,                                # ISO-8601
  "by-zone":      {zone-id: [hit, ...]},
  "by-family":    {family-name: [hit, ...]},
  "freshness":    [{path, verdict, days-since, threshold}, ...],
  "source-of-truth-conflicts": [
    {family, candidates: [hit, ...], resolution: <path>, resolved-by: rank|llm|unresolved, reason}
  ],
  "missing-perspectives": [{family, expected-min, actual}, ...],
  "traversal-hops": [{from, edge, to, depth}, ...],
  "unsatisfied-zone-requirements": [zone-id, ...],
  "stale-claims-by-doc": {                            # NEW (per-section staleness, U3)
    "<doc-path>": [{section, last-confirmed, see-evidence, note}, ...]
  },
  "escalations": [str, ...]
}

`stale-claims-by-doc` is a separate top-level block (per lesson L-019:
extend with new blocks, never fold into existing ones). It is populated
only for pool docs that declare `stale-claims:` in their frontmatter.
Consumers that don't care about per-claim staleness ignore the block; the
core envelope shape is unchanged.

Hits keep a small subset of context-index doc fields:
{path, name, zone, cluster, page-type, type, tags, exclusively_owns,
 last_updated, last_reviewed, age_days}.

Determinism: same fixture → byte-identical envelope (modulo `generated-at`).
"""

from __future__ import annotations

import argparse
import datetime
import json
import re
import sys
from pathlib import Path
from typing import Any

SCRIPT_DIR = Path(__file__).resolve().parent
REPO_ROOT = SCRIPT_DIR.parents[1]
DEFAULT_INDEX = REPO_ROOT / ".claude" / "quality" / "context-index.json"

if str(SCRIPT_DIR) not in sys.path:
    sys.path.insert(0, str(SCRIPT_DIR))

from load_task_profiles import load_task_profiles  # noqa: E402
from cross_repo_fetch import (  # noqa: E402
    fetch_sibling_corpora,
    is_local_insufficient,
    load_umbrella_config,
    peek_envelope,
    peek_sibling_corpora,
    peek_strength,
    status_envelope,
)

HIT_FIELDS = (
    "path",
    "name",
    "zone",
    "cluster",
    "page-type",
    "type",
    "tags",
    "exclusively_owns",
    "last-updated",
    "last-reviewed",
    "age_days",
)

# Pattern for the stale-claims: block inside a doc's frontmatter — matches
# the same shape that validate_frontmatter._validate_stale_claims accepts.
_STALE_CLAIMS_BLOCK_RE = re.compile(
    r"^stale-claims:\s*\n(?P<body>(?:[ \t]+.*\n?)+)",
    re.MULTILINE,
)
_FRONTMATTER_RE = re.compile(r"^---\s*\n(.*?)\n---", re.DOTALL)


def _parse_stale_claims_entries(block_text: str) -> list[dict[str, Any]]:
    """Mirror of validate_frontmatter._parse_stale_claims_block."""
    entries: list[dict[str, Any]] = []
    current: dict[str, Any] | None = None
    for raw in block_text.splitlines():
        if not raw.strip() or raw.lstrip().startswith("#"):
            continue
        if re.match(r"^\s*-\s+", raw):
            if current is not None:
                entries.append(current)
            current = {}
            after_dash = re.sub(r"^\s*-\s+", "", raw)
            key, _, val = after_dash.partition(":")
            if key:
                current[key.strip()] = val.strip().strip('"').strip("'")
            continue
        if current is not None and re.match(r"^\s+\S", raw):
            key, _, val = raw.strip().partition(":")
            if key:
                current[key.strip()] = val.strip().strip('"').strip("'")
    if current is not None:
        entries.append(current)
    return entries


def _extract_stale_claims_for_pool(
    pool: list[dict[str, Any]],
    repo_root: Path,
) -> dict[str, list[dict[str, Any]]]:
    """Return {doc-path: [stale-claim-entry, ...]} for pool docs that declare any.

    Reads each pool doc's file on demand. Silently skips docs whose file is
    unreadable, has no frontmatter, or has no `stale-claims:` block. Each
    returned entry is a dict with whatever keys the author wrote — the
    resolver does not enforce shape here (validate_frontmatter is the gate).
    """
    out: dict[str, list[dict[str, Any]]] = {}
    for doc in pool:
        path_str = doc.get("path")
        if not path_str:
            continue
        candidate = repo_root / path_str
        try:
            text = candidate.read_text(encoding="utf-8")
        except (OSError, UnicodeDecodeError):
            continue
        fm = _FRONTMATTER_RE.match(text)
        if not fm:
            continue
        block = _STALE_CLAIMS_BLOCK_RE.search(fm.group(1))
        if not block:
            continue
        entries = _parse_stale_claims_entries(block.group("body"))
        if entries:
            out[path_str] = entries
    return out


class LLMEscalationNotImplementedError(NotImplementedError):
    """Raised when --resolve-conflicts or --verify-coverage runs without --dry-run.

    The mechanical bundle is always available; LLM-touching paths require
    explicit opt-in AND --dry-run until the client wiring lands.
    """


# ---------------------------------------------------------------------------
# Public entry point
# ---------------------------------------------------------------------------


def resolve_bundle(
    profile_id: str,
    *,
    profiles: list[dict[str, Any]] | None = None,
    profiles_path: Path | None = None,
    index: dict[str, Any] | None = None,
    index_path: Path | None = None,
    resolve_conflicts: bool = False,
    verify_coverage: bool = False,
    dry_run: bool = False,
    now: datetime.datetime | None = None,
    cross_repo: bool | None = None,
    repo_root: Path | None = None,
    _disable_cross_repo_recursion: bool = False,
) -> dict[str, Any]:
    """Resolve the bundle envelope for `profile_id`.

    `cross_repo`:
      - None  → use `.bcos-umbrella.json.retrieval.auto_fallthrough`
      - True  → force on (`--cross-repo`)
      - False → force off (`--no-cross-repo`)

    See `docs/_bcos-framework/architecture/cross-repo-retrieval.md` for the
    contract. Sibling bundles are NEVER merged into `by-zone` / `by-family` —
    they appear in a separate top-level `cross-repo-hits` block, so local
    authority is preserved and the caller decides whether to consult them.
    """
    if profiles is None:
        profiles = load_task_profiles(profiles_path)
    profile = _find_profile(profile_id, profiles)
    if profile is None:
        raise ValueError(f"profile not found: {profile_id!r}")

    if index is None:
        target = index_path or DEFAULT_INDEX
        if target.is_file():
            index = json.loads(target.read_text(encoding="utf-8"))
        else:
            index = {"docs": [], "edges": []}

    escalations = _resolve_escalations(
        resolve_conflicts=resolve_conflicts,
        verify_coverage=verify_coverage,
        dry_run=dry_run,
    )

    docs = list(index.get("docs") or [])
    edges = list(index.get("edges") or [])

    # 1. Build the candidate pool: docs in declared zones AND matching at
    #    least one declared content family. Without the family filter, an
    #    optional zone (e.g., planned=false) dumps every doc into the bundle
    #    even when none are task-relevant — that's the regression the audit
    #    flagged. Profiles with zero families (rare) fall back to all-zone-
    #    docs so they aren't silently empty.
    declared_zones = [z["id"] for z in profile.get("required-zones") or []]
    families = profile.get("content-families") or []
    in_zone = [d for d in docs if d.get("zone") in declared_zones]
    if families:
        pool = [d for d in in_zone if _doc_matches_any_family(d, families)]
    else:
        pool = in_zone

    # 2. Walk graph edges from seed pool up to depth-cap.
    traversal_hops = _walk_edges(pool, edges, profile.get("traversal-hints") or [])

    # 3. Group hits by family via pattern matching (subset of pool).
    by_family = _group_by_family(pool, families)

    # 4. Group hits by zone (the matched pool, not every in-zone doc).
    by_zone = _group_by_zone(pool)

    # 5. Freshness verdict per hit.
    freshness = _freshness_verdicts(pool, profile.get("freshness-thresholds") or {}, now)

    # 6. Source-of-truth conflict detection.
    conflicts = _detect_conflicts(by_family, profile.get("source-of-truth-ranking") or [])

    # 7. Coverage gaps: families failing coverage-assertions min-count.
    missing = _missing_perspectives(by_family, profile.get("coverage-assertions") or {})

    # 8. Unsatisfied required zones.
    unsatisfied = _unsatisfied_zones(profile, docs)

    # 9. Per-doc stale-claims (U3) — surface as a separate top-level block;
    #    never fold into by-zone / by-family (per lesson L-019).
    effective_root = repo_root or REPO_ROOT
    stale_claims_by_doc = _extract_stale_claims_for_pool(pool, effective_root)

    local_bundle: dict[str, Any] = {
        "profile-id": profile_id,
        "generated-at": _now_iso(now),
        "by-zone": by_zone,
        "by-family": by_family,
        "freshness": freshness,
        "source-of-truth-conflicts": conflicts,
        "missing-perspectives": missing,
        "traversal-hops": traversal_hops,
        "unsatisfied-zone-requirements": unsatisfied,
        "stale-claims-by-doc": stale_claims_by_doc,
        "escalations": escalations,
    }

    if _disable_cross_repo_recursion:
        return local_bundle

    return _maybe_extend_with_cross_repo(
        local_bundle,
        profile_id=profile_id,
        profiles=profiles,
        profiles_path=profiles_path,
        resolve_conflicts=resolve_conflicts,
        verify_coverage=verify_coverage,
        dry_run=dry_run,
        now=now,
        cross_repo=cross_repo,
        repo_root=repo_root or REPO_ROOT,
    )


# ---------------------------------------------------------------------------
# Cross-repo extension
# ---------------------------------------------------------------------------


def _maybe_extend_with_cross_repo(
    local_bundle: dict[str, Any],
    *,
    profile_id: str,
    profiles: list[dict[str, Any]] | None,
    profiles_path: Path | None,
    resolve_conflicts: bool,
    verify_coverage: bool,
    dry_run: bool,
    now: datetime.datetime | None,
    cross_repo: bool | None,
    repo_root: Path,
) -> dict[str, Any]:
    """Three-stage filter for cross-repo bundle resolution. D-10 strict.

    Mirrors context_search.py._maybe_extend_with_cross_repo. Sibling bundle
    data lives in a separate `cross-repo-hits` block on the peek-strong path,
    never folded into local `by-zone` / `by-family`. On the peek-marginal
    path, no deep-fetch runs; instead a `cross-repo-suggestions` block carries
    per-sibling metadata-only signals for the calling agent to act on.
    """
    cfg = load_umbrella_config(repo_root)

    # Gate 1: explicit --no-cross-repo
    if cross_repo is False:
        if cfg.present:
            local_bundle["cross-repo-status"] = status_envelope(
                attempted=False, trigger="explicit-no", fetch_result=None,
            )
        return local_bundle

    # Gate 2: no umbrella file → single-repo behavior
    if not cfg.present:
        return local_bundle

    # Gate 3: explicit --cross-repo → bypass peek, deep-fetch directly
    if cross_repo is True:
        return _bundle_deep_fetch(
            local_bundle, cfg=cfg, trigger="explicit-flag",
            profile_id=profile_id, profiles=profiles, profiles_path=profiles_path,
            resolve_conflicts=resolve_conflicts, verify_coverage=verify_coverage,
            dry_run=dry_run, now=now,
        )

    # Gate 4: not opted-in
    if not cfg.retrieval_block_present or not cfg.auto_fallthrough:
        local_bundle["cross-repo-status"] = status_envelope(
            attempted=False, trigger="not-opted-in", fetch_result=None,
        )
        return local_bundle

    # Gate 5: local-sufficient. Bundle's "local view" for miss-signal eval is
    # the flat list of all hits across by-family + the unsatisfied-zone list.
    fake_local_result = {
        "hits": _flatten_family_hits(local_bundle.get("by-family") or {}),
        "unsatisfied-zone-requirements": local_bundle.get("unsatisfied-zone-requirements") or [],
    }
    insufficient, signal = is_local_insufficient(fake_local_result, cfg.miss_signals)
    if not insufficient:
        local_bundle["cross-repo-status"] = status_envelope(
            attempted=False, trigger="local-sufficient", fetch_result=None,
        )
        return local_bundle

    # Gate 6: peek. Bundle uses the profile's families' patterns as the query
    # surface (translated to tokens). Falls back to profile-id keywords when
    # families are empty.
    query_tokens = _bundle_query_tokens(profile_id, profiles, profiles_path)
    peek_result = peek_sibling_corpora(cfg, query_tokens)
    strength, _winner = peek_strength(peek_result, cfg)

    if strength == "strong":
        return _bundle_deep_fetch(
            local_bundle, cfg=cfg, trigger="auto-fallthrough",
            profile_id=profile_id, profiles=profiles, profiles_path=profiles_path,
            resolve_conflicts=resolve_conflicts, verify_coverage=verify_coverage,
            dry_run=dry_run, now=now,
            insufficient_signal=signal,
        )

    # Marginal or none: surface suggestions, no deep-fetch.
    trigger = "peek-empty" if strength == "none" else "peek-marginal"
    local_bundle["cross-repo-status"] = status_envelope(
        attempted=False, trigger=trigger, fetch_result=None,
    )
    local_bundle["cross-repo-status"]["umbrella-id"] = cfg.umbrella_id
    local_bundle["cross-repo-status"]["local-insufficient-signal"] = signal
    if strength == "marginal":
        local_bundle["cross-repo-suggestions"] = peek_envelope(peek_result, strength)
    if peek_result.fatal:
        local_bundle["cross-repo-status"]["fatal"] = peek_result.fatal
    if peek_result.skipped:
        local_bundle["cross-repo-status"]["siblings-skipped"] = [
            {"id": s.id, "reason": s.reason, **({"detail": s.detail} if s.detail else {})}
            for s in peek_result.skipped
        ]
    return local_bundle


def _bundle_deep_fetch(
    local_bundle: dict[str, Any],
    *,
    cfg,
    trigger: str,
    profile_id: str,
    profiles: list[dict[str, Any]] | None,
    profiles_path: Path | None,
    resolve_conflicts: bool,
    verify_coverage: bool,
    dry_run: bool,
    now: datetime.datetime | None,
    insufficient_signal: str | None = None,
) -> dict[str, Any]:
    """Pull full sibling bundles, tag with source-repo, attach as cross-repo-hits."""
    fetch_result = fetch_sibling_corpora(cfg)
    sibling_bundles: dict[str, dict[str, Any]] = {}
    for sibling in fetch_result.siblings:
        sibling_bundle = resolve_bundle(
            profile_id, profiles=profiles, profiles_path=profiles_path,
            index={"docs": sibling.docs, "edges": []},
            resolve_conflicts=resolve_conflicts, verify_coverage=verify_coverage,
            dry_run=dry_run, now=now, cross_repo=False,
            _disable_cross_repo_recursion=True,
        )
        for hits_in_zone in (sibling_bundle.get("by-zone") or {}).values():
            for hit in hits_in_zone:
                hit["source-repo"] = sibling.id
        for hits_in_family in (sibling_bundle.get("by-family") or {}).values():
            for hit in hits_in_family:
                hit["source-repo"] = sibling.id
        sibling_bundles[sibling.id] = {
            "by-zone": sibling_bundle.get("by-zone") or {},
            "by-family": sibling_bundle.get("by-family") or {},
            "unsatisfied-zone-requirements": sibling_bundle.get("unsatisfied-zone-requirements") or [],
        }

    if sibling_bundles:
        local_bundle["cross-repo-hits"] = sibling_bundles

    local_bundle["cross-repo-status"] = status_envelope(
        attempted=True, trigger=trigger, fetch_result=fetch_result,
    )
    if insufficient_signal:
        local_bundle["cross-repo-status"]["local-insufficient-signal"] = insufficient_signal
    return local_bundle


def _bundle_query_tokens(
    profile_id: str,
    profiles: list[dict[str, Any]] | None,
    profiles_path: Path | None,
) -> list[str]:
    """Build query tokens for the peek from a profile's families.

    Pulls tag/cluster/page-type values out of family patterns
    (`cluster=Strategy`, `tag=incident`, etc.) and treats them as a token set.
    Falls back to splitting the profile-id on non-alphanumerics so an unknown
    profile still produces something.
    """
    out: set[str] = set()
    try:
        if profiles is None:
            profiles = load_task_profiles(profiles_path)
        profile = _find_profile(profile_id, profiles or [])
    except Exception:
        profile = None
    if profile:
        for family in profile.get("content-families") or []:
            pattern = (family.get("pattern") or "").strip()
            if "=" in pattern:
                _, _, value = pattern.partition("=")
                value = value.strip()
                for tok in re.findall(r"[a-zA-Z0-9]+", value):
                    if len(tok) >= 2:
                        out.add(tok.lower())
            name = (family.get("name") or "").strip()
            for tok in re.findall(r"[a-zA-Z0-9]+", name):
                if len(tok) >= 2:
                    out.add(tok.lower())
    if not out:
        for tok in re.findall(r"[a-zA-Z0-9]+", profile_id):
            if len(tok) >= 2:
                out.add(tok.lower())
    return sorted(out)


def _flatten_family_hits(by_family: dict[str, list[dict[str, Any]]]) -> list[dict[str, Any]]:
    """Flatten by-family map into a single hits list for miss-signal checks."""
    flat: list[dict[str, Any]] = []
    seen_paths: set[str] = set()
    for hits in by_family.values():
        for hit in hits:
            path = hit.get("path") or ""
            if path in seen_paths:
                continue
            seen_paths.add(path)
            flat.append(hit)
    return flat


# ---------------------------------------------------------------------------
# Internals
# ---------------------------------------------------------------------------


def _find_profile(profile_id: str, profiles: list[dict[str, Any]]) -> dict[str, Any] | None:
    for p in profiles:
        if p.get("id") == profile_id:
            return p
    return None


def _now_iso(now: datetime.datetime | None) -> str:
    moment = now or datetime.datetime.now(datetime.timezone.utc)
    return moment.isoformat(timespec="seconds").replace("+00:00", "Z")


def _hit_view(doc: dict[str, Any]) -> dict[str, Any]:
    out: dict[str, Any] = {}
    for field in HIT_FIELDS:
        # Index uses underscores for some keys; honor either form.
        if field in doc:
            out[field] = doc[field]
        elif field.replace("-", "_") in doc:
            out[field] = doc[field.replace("-", "_")]
        else:
            out[field] = None
    return out


def _group_by_zone(pool: list[dict[str, Any]]) -> dict[str, list[dict[str, Any]]]:
    out: dict[str, list[dict[str, Any]]] = {}
    for doc in pool:
        zone = doc.get("zone") or "unknown"
        out.setdefault(zone, []).append(_hit_view(doc))
    return {z: out[z] for z in sorted(out.keys())}


def _group_by_family(
    pool: list[dict[str, Any]], families: list[dict[str, Any]]
) -> dict[str, list[dict[str, Any]]]:
    out: dict[str, list[dict[str, Any]]] = {f["name"]: [] for f in families}
    for doc in pool:
        for family in families:
            if _doc_matches_pattern(doc, family.get("pattern", "")):
                out[family["name"]].append(_hit_view(doc))
    return out


def _doc_matches_any_family(doc: dict[str, Any], families: list[dict[str, Any]]) -> bool:
    """True when `doc` matches at least one declared content-family pattern."""
    for family in families:
        if _doc_matches_pattern(doc, family.get("pattern", "")):
            return True
    return False


def _doc_matches_pattern(doc: dict[str, Any], pattern: str) -> bool:
    """Pattern grammar: `cluster=<v>`, `tag=<v>`, `page-type=<v>`, `type=<v>`."""
    pattern = pattern.strip()
    if "=" not in pattern:
        return False
    key, _, value = pattern.partition("=")
    key = key.strip()
    value = value.strip()
    if key == "cluster":
        return (doc.get("cluster") or "") == value
    if key == "tag":
        return value in (doc.get("tags") or [])
    if key == "page-type":
        return (doc.get("page_type") or doc.get("page-type") or "") == value
    if key == "type":
        return (doc.get("type") or "") == value
    return False


def _freshness_verdicts(
    pool: list[dict[str, Any]],
    thresholds: dict[str, int | None],
    now: datetime.datetime | None,
) -> list[dict[str, Any]]:
    out: list[dict[str, Any]] = []
    for doc in pool:
        zone = doc.get("zone")
        if zone not in thresholds:
            continue
        threshold = thresholds[zone]
        age = doc.get("age_days")
        verdict = _verdict_from_age(age, threshold)
        out.append({
            "path": doc.get("path"),
            "zone": zone,
            "verdict": verdict,
            "days-since": age,
            "threshold": threshold,
        })
    out.sort(key=lambda x: (x.get("path") or ""))
    return out


def _verdict_from_age(age: int | None, threshold: int | None) -> str:
    if threshold is None:
        return "fresh"  # never-stale zones (frozen evidence, framework, etc.)
    if age is None:
        return "unknown"
    if age > threshold:
        return "past-threshold"
    if age > threshold // 2:
        return "stale"
    return "fresh"


def _detect_conflicts(
    by_family: dict[str, list[dict[str, Any]]],
    ranking: list[str],
) -> list[dict[str, Any]]:
    """Mechanical conflict detection: hits in the same family that share ≥1
    `exclusively_owns` key across different zones are CLEAR-violation candidates.

    Resolution uses the profile's `source-of-truth-ranking`: the first zone
    that appears wins. If all candidates are in the same zone, the conflict is
    `unresolved` (mechanical can't decide; agent should escalate).
    """
    rank_index = {z: i for i, z in enumerate(ranking)}
    conflicts: list[dict[str, Any]] = []
    for family, hits in by_family.items():
        # Build owns→[hits] index for this family
        owns_to_hits: dict[str, list[dict[str, Any]]] = {}
        for hit in hits:
            for own in hit.get("exclusively_owns") or []:
                owns_to_hits.setdefault(own, []).append(hit)
        # A conflict is any owns-key with ≥2 hits from different zones.
        for own, group in owns_to_hits.items():
            zones = {h.get("zone") for h in group}
            if len(zones) < 2:
                continue
            # Build canonical conflict candidate set (deduplicate by path)
            seen_paths: set[str] = set()
            candidates: list[dict[str, Any]] = []
            for h in group:
                path = h.get("path")
                if path in seen_paths:
                    continue
                seen_paths.add(path)
                candidates.append(h)
            # Have we already recorded a conflict over the same candidates+family?
            sig = (family, tuple(sorted(seen_paths)))
            if any(_conflict_signature(c) == sig for c in conflicts):
                continue
            resolution_path, resolved_by, reason = _resolve_conflict(candidates, rank_index)
            conflicts.append({
                "family": family,
                "shared-owns": own,
                "candidates": candidates,
                "resolution": resolution_path,
                "resolved-by": resolved_by,
                "reason": reason,
            })
    conflicts.sort(key=lambda c: (c["family"], c.get("shared-owns") or ""))
    return conflicts


def _conflict_signature(c: dict[str, Any]) -> tuple[str, tuple[str, ...]]:
    paths = tuple(sorted((h.get("path") or "") for h in c.get("candidates") or []))
    return (c.get("family") or "", paths)


def _resolve_conflict(
    candidates: list[dict[str, Any]],
    rank_index: dict[str, int],
) -> tuple[str | None, str, str]:
    """Return (winning_path, resolved-by, reason).

    Picks the candidate whose zone has the lowest rank index. Ties (same zone
    or no ranking) yield resolved-by="unresolved".
    """
    if not candidates:
        return None, "unresolved", "no candidates"
    if not rank_index:
        return None, "unresolved", "no source-of-truth-ranking declared"
    ranked = sorted(
        candidates,
        key=lambda h: (rank_index.get(h.get("zone") or "", 99), h.get("path") or ""),
    )
    top = ranked[0]
    top_rank = rank_index.get(top.get("zone") or "", 99)
    # If the top is tied with the second by zone-rank, that's an unresolved tie
    if len(ranked) > 1:
        second_rank = rank_index.get(ranked[1].get("zone") or "", 99)
        if top_rank == second_rank:
            return None, "unresolved", "candidates share top zone-rank"
    if top_rank == 99:
        return None, "unresolved", "top candidate's zone not in ranking"
    return top.get("path"), "rank", f"highest-ranked zone: {top.get('zone')}"


def _missing_perspectives(
    by_family: dict[str, list[dict[str, Any]]],
    coverage: dict[str, int],
) -> list[dict[str, Any]]:
    out: list[dict[str, Any]] = []
    for family, expected in coverage.items():
        actual = len(by_family.get(family) or [])
        if actual < expected:
            out.append({
                "family": family,
                "expected-min": expected,
                "actual": actual,
            })
    out.sort(key=lambda x: x["family"])
    return out


def _unsatisfied_zones(profile: dict[str, Any], docs: list[dict[str, Any]]) -> list[str]:
    present = {d.get("zone") for d in docs if d.get("zone")}
    out: list[str] = []
    for entry in profile.get("required-zones") or []:
        if not entry.get("required"):
            continue
        if entry.get("id") not in present:
            out.append(entry["id"])
    out.sort()
    return out


def _walk_edges(
    pool: list[dict[str, Any]],
    edges: list[dict[str, Any]],
    hints: list[dict[str, Any]],
) -> list[dict[str, Any]]:
    """Walk typed edges from seed pool up to depth-cap.

    Each hint declares `from-edge` (e.g., builds-on) and `depth-cap`. We BFS
    from every seed path, following only edges of the declared kind, recording
    each hop with its depth.
    """
    if not hints:
        return []

    seed_paths = {d.get("path") for d in pool if d.get("path")}
    edges_by_from: dict[str, list[dict[str, Any]]] = {}
    for e in edges:
        edges_by_from.setdefault(e.get("from") or "", []).append(e)

    hops: list[dict[str, Any]] = []
    for hint in hints:
        edge_kind = hint.get("from-edge")
        depth_cap = hint.get("depth-cap") or 0
        if not edge_kind or depth_cap <= 0:
            continue
        for seed in seed_paths:
            visited = {seed}
            frontier = [(seed, 0)]
            while frontier:
                node, depth = frontier.pop(0)
                if depth >= depth_cap:
                    continue
                for e in edges_by_from.get(node, []):
                    if e.get("kind") != edge_kind:
                        continue
                    target = e.get("to")
                    if not target or target in visited:
                        continue
                    visited.add(target)
                    hops.append({
                        "from": node,
                        "edge": edge_kind,
                        "to": target,
                        "depth": depth + 1,
                    })
                    frontier.append((target, depth + 1))
    # Deduplicate (same from/edge/to retained once at lowest depth)
    seen: dict[tuple, dict[str, Any]] = {}
    for hop in hops:
        key = (hop["from"], hop["edge"], hop["to"])
        if key not in seen or hop["depth"] < seen[key]["depth"]:
            seen[key] = hop
    return sorted(seen.values(), key=lambda h: (h["from"], h["edge"], h["to"]))


def _resolve_escalations(
    *, resolve_conflicts: bool, verify_coverage: bool, dry_run: bool
) -> list[str]:
    """D-10 strict: opt-in flags + --dry-run record opt-in; non-dry-run raises."""
    escalations: list[str] = []
    if resolve_conflicts:
        if not dry_run:
            raise LLMEscalationNotImplementedError(
                "--resolve-conflicts requires --dry-run for now. The LLM "
                "conflict-resolution path is specified by P5 but the LLM "
                "client wiring is deferred. Use --dry-run to validate the "
                "opt-in envelope without firing the LLM."
            )
        escalations.append("resolve-conflicts-dry-run")
    if verify_coverage:
        if not dry_run:
            raise LLMEscalationNotImplementedError(
                "--verify-coverage requires --dry-run for now. The LLM "
                "coverage-verification path is specified by P5 but the LLM "
                "client wiring is deferred."
            )
        escalations.append("verify-coverage-dry-run")
    return escalations


# ---------------------------------------------------------------------------
# CLI
# ---------------------------------------------------------------------------


def parse_args(argv: list[str]) -> argparse.Namespace:
    p = argparse.ArgumentParser(
        description="Task-driven cross-zone bundle resolver."
    )
    p.add_argument("--profile", required=True, help="Profile id (e.g. market-report:write)")
    p.add_argument("--profiles-path", type=Path, default=None, help="Override path to profiles catalog")
    p.add_argument("--index", type=Path, default=None, help="Override path to context-index.json")
    p.add_argument("--index-root", type=Path, default=None, help="Build index from this docs root instead of reading the JSON")
    p.add_argument("--resolve-conflicts", action="store_true")
    p.add_argument("--verify-coverage", action="store_true")
    p.add_argument("--dry-run", action="store_true")
    p.add_argument("--json", action="store_true", help="Emit JSON to stdout")
    cross = p.add_mutually_exclusive_group()
    cross.add_argument(
        "--cross-repo",
        dest="cross_repo",
        action="store_const",
        const=True,
        default=None,
        help=(
            "Force cross-repo fallthrough on. Reads .bcos-umbrella.json. Sibling "
            "bundles appear in a separate `cross-repo-hits` block — never merged "
            "into by-zone / by-family. Local authority preserved."
        ),
    )
    cross.add_argument(
        "--no-cross-repo",
        dest="cross_repo",
        action="store_const",
        const=False,
        help="Force cross-repo fallthrough off.",
    )
    return p.parse_args(argv)


def _build_index_from_root(root: Path) -> dict[str, Any]:
    from context_index import build_context_index

    return build_context_index(root)


def main(argv: list[str] | None = None) -> int:
    args = parse_args(argv or sys.argv[1:])
    index = None
    if args.index_root is not None:
        index = _build_index_from_root(args.index_root)
    try:
        bundle = resolve_bundle(
            args.profile,
            profiles_path=args.profiles_path,
            index=index,
            index_path=args.index,
            resolve_conflicts=args.resolve_conflicts,
            verify_coverage=args.verify_coverage,
            dry_run=args.dry_run,
            cross_repo=args.cross_repo,
        )
    except LLMEscalationNotImplementedError as exc:
        print(f"error: {exc}", file=sys.stderr)
        return 2
    if args.json:
        print(json.dumps(bundle, indent=2, ensure_ascii=False))
    else:
        _print_human(bundle)
    return 0


def _print_human(bundle: dict[str, Any]) -> None:
    print(f"profile-id:    {bundle['profile-id']}")
    print(f"generated-at:  {bundle['generated-at']}")
    print(f"by-zone:       " + ", ".join(f"{z}({len(h)})" for z, h in bundle["by-zone"].items()))
    print(f"by-family:     " + ", ".join(f"{f}({len(h)})" for f, h in bundle["by-family"].items()))
    if bundle["source-of-truth-conflicts"]:
        print(f"conflicts:     {len(bundle['source-of-truth-conflicts'])}")
        for c in bundle["source-of-truth-conflicts"]:
            print(f"  - family={c['family']} owns={c['shared-owns']} resolution={c['resolution']} ({c['resolved-by']})")
    if bundle["missing-perspectives"]:
        print(f"missing:       {bundle['missing-perspectives']}")
    if bundle["unsatisfied-zone-requirements"]:
        print(f"unsatisfied:   {bundle['unsatisfied-zone-requirements']}")
    if bundle["escalations"]:
        print(f"escalations:   {bundle['escalations']}")
    cross = bundle.get("cross-repo-status")
    if cross:
        attempted = cross.get("attempted")
        trigger = cross.get("trigger", "?")
        if attempted:
            queried = cross.get("siblings-queried") or []
            skipped_siblings = cross.get("siblings-skipped") or []
            fatal = cross.get("fatal")
            print(
                f"cross-repo:    {trigger} — queried {len(queried)}, skipped {len(skipped_siblings)}"
                + (f", fatal: {fatal}" if fatal else "")
            )
            crh = bundle.get("cross-repo-hits") or {}
            if crh:
                print(f"               siblings-with-hits: {', '.join(sorted(crh.keys()))}")
        else:
            print(f"cross-repo:    not-attempted ({trigger})")


__all__ = ["resolve_bundle", "LLMEscalationNotImplementedError"]


if __name__ == "__main__":
    raise SystemExit(main())
278 files · 9 not served here

Advantages

Limitations

  • Requires adherence to a specific folder structure and frontmatter schema to function correctly. evidence: README.md
  • Maintenance jobs and dispatcher functionality rely on Python and bash being available on the host system. evidence: README.md

Security

Risk level: Medium risk

This brain runs

Agent instructions that run or fetch something (170)

  • .claude/agents/wiki-fetch/AGENT.md: A 100k-token URL fetched into the main thread by `/wiki run` saturates the context window before a single page lands.
  • .claude/agents/wiki-fetch/AGENT.md: | Calling skill | Subcommand | Trigger | |---|---|---| | `bcos-wiki` | `run` Pass 1 | Each URL in the queue → one `wiki-fetch` invocation | | `bcos-wiki` | `refresh` full-tier | Source-summary past `stale_threshold_days` and HEAD signals changed | | `bcos-wiki` | `promote` (Path B) | S …[+132 chars] · uses the network
  • .claude/agents/wiki-fetch/AGENT.md: The cumulative budget guard ([`_wiki_budget.decide_dispatch_strategy`](../../scripts/_wiki_budget.py)) decides whether N sub-agents run in parallel or serial — `parallel` when projected cumulative tokens stay ≤ 80% of the main context limit;
  • .claude/agents/wiki-fetch/AGENT.md: queue an explicit retry tag for next run | | `error.kind: fetch-error` | 4xx/5xx from upstream | Surface to user;
  • .claude/agents/wiki-fetch/AGENT.md: `python .claude/scripts/test_wiki_fetch.py` — asserts this AGENT.md declares the documented input kinds and output fields, that the 4000-token cap is stated, that calling-skill docs reference both `wiki-fetch` and the Task tool, and that the result-schema validator + cumulative budget g …[+47 chars]
  • .claude/skills/bcos-wiki/SKILL.md: **`/wiki`** with subcommands: `init`, `init --defaults`, `run`, `queue`, `promote`, `create`, `review`, `archive`, `refresh`, `lint`, `remove`, `schema`, `search`
  • .claude/skills/bcos-wiki/SKILL.md: "Run the wiki refresh"
  • .claude/skills/bcos-wiki/SKILL.md: | | `run [<url>]` | implemented | P3 | Path A: batch (no arg) processes all `## Pending` queue items;
  • .claude/skills/bcos-wiki/SKILL.md: single (with URL) auto-queues + ingests | | `queue <url> [tags]` | implemented | P3 | Append URL to `## Pending` of `queue.md` without fetching | | `ingest` | shared protocol | P3 | Internal — called by `run`/`promote`/`create`;
  • .claude/skills/bcos-wiki/SKILL.md: optionally re-pull `builds-on` data points to verify | | `archive <slug>` | implemented | P3 | Soft-delete to `_wiki/.archive/` with dangling-reference scan | | `refresh <slug>` | implemented | P3 | Path A: re-fetch a `source-summary` page (refresh-must-rediscover applies, D-05 two-tie …[+470 chars]
  • .claude/skills/bcos-wiki/SKILL.md: `run` → `run.md`
  • .claude/skills/bcos-wiki/SKILL.md: Run `/wiki init` first."* and exit.
  • .claude/skills/bcos-wiki/SKILL.md: | Choice | Behavior | |---|---| | Init with defaults + proceed | Run `.claude/scripts/cmd_wiki_init.py` (or equivalent `ensure_wiki_zone.py` call).
  • .claude/skills/bcos-wiki/SKILL.md: Then resume the original subcommand (`create from`, `promote`, `run`, etc.) as if the Guard had passed.
  • .claude/skills/bcos-wiki/SKILL.md: | | Full interview + proceed | Read `init.md` and run the 6-question interactive scaffold.
  • .claude/skills/bcos-wiki/SKILL.md: The dispatched subcommand files (`create.md`, `promote.md`, `run.md`, `refresh.md`, `lint.md`, `archive.md`, `review.md`, `remove.md`, `schema.md`, `search.md`, `bundle.md`, `queue.md`) all reference *"the `.config.yml` Guard defined in `SKILL.md`"* — they inherit this AskUserQuestion p …[+46 chars]
  • .claude/skills/bcos-wiki/SKILL.md: The human reviews diffs and runs `git commit` / `git push` when ready. · uses the network
  • .claude/skills/bcos-wiki/SKILL.md: This applies to `run`, `refresh`, and `create` (when source content is large).
  • .claude/skills/bcos-wiki/SKILL.md: Users who want a binary in collections-as-evidence must run `/collections add` explicitly.
  • .claude/skills/bcos-wiki/SKILL.md: ├── run.md ← /wiki run [<url>]
  • .claude/skills/bcos-wiki/SKILL.md: ├── ingest.md ← shared ingest pipeline (called by run/promote/create/refresh)
  • .claude/skills/clear-planner/SKILL.md: Step 2: Run Discovery
  • .claude/skills/clear-planner/SKILL.md: { "step": 2, "name": "Run Discovery", "status": "in_progress" }
  • .claude/skills/clear-planner/SKILL.md: **Run all three discovery scripts:**
  • .claude/skills/clear-planner/SKILL.md: bash .claude/agents/agent-discovery/find_agents.sh
  • .claude/skills/clear-planner/SKILL.md: bash .claude/skills/skill-discovery/find_skills.sh
  • .claude/skills/clear-planner/SKILL.md: python .claude/scripts/find_lessons.py --tags "#{scenarioType}"
  • .claude/skills/clear-planner/SKILL.md: Run discovery scripts (Step 2 results)
  • .claude/skills/clear-planner/SKILL.md: | | ------------------- | ------------------------------------ | --------------------------------------------------------- | ------------------- | | Integration Audit | Detect stale references in ecosystem | `python .claude/scripts/analyze_integration.py --staged` + AI review | **YES …[+455 chars]
  • .claude/skills/clear-planner/SKILL.md: | Scenario | Key Requirement | | ----------------- | ------------------------------------------------------------------ | | **AGENTING** | Check for ecosystem overlaps + run integration audit before commit | | **DOCUMENTAT …[+76 chars]
  • .claude/skills/context-audit/SKILL.md: Run all five audit categories against the scoped files.
  • .claude/skills/context-audit/SKILL.md: python .claude/scripts/build_document_index.py
  • .claude/skills/context-ingest/SKILL.md: | Input shape | Dispatch to | Why | |-------------|-------------|-----| | HTTP/HTTPS URL (article, GitHub, YouTube) | `/wiki run <url>` (the `bcos-wiki` skill, Path A) | Wiki owns external-source ingest, banner citations, schema validation, refresh tier | | Path inside `docs/_inbox/` a …[+508 chars]
  • .claude/skills/context-ingest/SKILL.md: If the input is mixed (e.g. Slack export *and* a URL), do mine first, then handle the URL via `/wiki run` separately, then return to ingest for whatever's left.
  • .claude/skills/context-ingest/SKILL.md: Run `python .claude/scripts/build_document_index.py` after material changes
  • .claude/skills/context-ingest/SKILL.md: **→ Rebuild Document Index** — Always: `python .claude/scripts/build_document_index.py`
  • .claude/skills/context-ingest/SKILL.md: **→ context-audit** — If a new data point was created: "Want me to run a quick CLEAR audit on the new doc?"
  • .claude/skills/context-mine/SKILL.md: Recommend: "Run context-ingest to classify and route these items"
  • .claude/skills/context-onboarding/SKILL.md: | What you see | What you do | |---|---| | User shares a URL, pitch deck, or describes their business | Gather from those sources, ask 2-3 follow-ups if needed | | Repo already has docs/, README, markdown files with business content | Scan the repo, map what exists | | User drops files …[+394 chars] · uses the network
  • .claude/skills/context-onboarding/SKILL.md: Before anything else, run **once** per onboarding session to make sure the BCOS-managed instructions are present in `CLAUDE.md`.
  • .claude/skills/context-onboarding/SKILL.md: This catches the `git clone`-without-`install.sh` case: if `CLAUDE.md` exists but lacks the `<!-- BCOS:CORE:START -->` / `<!-- BCOS:CORE:END -->` markers, the framework section is missing or unstructured. · uses the network
  • .claude/skills/context-onboarding/SKILL.md: If `.claude/bcos-claude-reference.md` doesn't exist yet (fresh clone), point `--source` at the upstream template available in this repo's tree (the same file install.sh would have copied).
  • .claude/skills/context-onboarding/SKILL.md: **First-run routing principle:** onboarding is allowed to identify all BCOS zones, but it should only create active data points after the user approves the architecture.
  • .claude/skills/context-onboarding/SKILL.md: | Material | First-run handling | |---|---| | Canonical facts, current decisions, project/task/business reality | Draft active data points in `docs/*.md` | | Raw notes, unsorted snippets, uncertain material | Keep in `docs/_inbox/` until triaged | | Future ideas, plans, or maybes | Par …[+578 chars]
  • .claude/skills/context-onboarding/SKILL.md: Options: **Activate** (set all to active, run index + wake-up) / **Adjust** (tell me what to fix)
  • .claude/skills/context-onboarding/SKILL.md: Run `python .claude/scripts/build_document_index.py` to generate the Document Index with DOMAIN one-liners
  • .claude/skills/context-onboarding/SKILL.md: Run `python .claude/scripts/generate_wakeup_context.py` to generate the Wake-Up Context for instant session orientation
  • .claude/skills/context-onboarding/SKILL.md: The checklist ships with install at `docs/.onboarding-checklist.md`.
  • .claude/skills/context-onboarding/SKILL.md: Ensure the `.claude/hook_state/` directory exists (it usually does from install.sh — check and create if missing).
  • .claude/skills/context-onboarding/SKILL.md: the dispatcher will create it on first run.
  • .claude/skills/context-onboarding/SKILL.md: **Run the catalog drift guard:**
  • .claude/skills/context-onboarding/SKILL.md: python .claude/scripts/validate_permissions_catalog.py
  • .claude/skills/context-onboarding/SKILL.md: python .claude/scripts/update.py
  • .claude/skills/context-onboarding/SKILL.md: Re-run the validator to confirm clean.
  • .claude/skills/context-onboarding/SKILL.md: If the answer is "Yes, multi-repo" (or the user confirms after explanation), run:
  • .claude/skills/context-onboarding/SKILL.md: python .claude/scripts/install_global_permissions.py
  • .claude/skills/context-onboarding/SKILL.md: Question: "When should the morning dispatcher run?"
  • .claude/skills/context-onboarding/SKILL.md: Run the schedule-dispatcher skill to execute today's scheduled CLEAR maintenance. It will:
  • .claude/skills/context-onboarding/SKILL.md: 3. Execute each job in sequence, appending one diary entry per job
  • .claude/skills/context-onboarding/SKILL.md: The portfolio aggregator picks it up on the next dispatcher run.
  • .claude/skills/context-onboarding/SKILL.md: The dispatcher will run in the wrong directory and writes meant for this repo's `docs/_inbox/` will be blocked.
  • .claude/skills/context-onboarding/SKILL.md: If "Recreate", call `mcp__scheduled-tasks__delete_event` (or the equivalent delete tool) on the bad task, then re-run Step 6d.
  • .claude/skills/context-onboarding/SKILL.md: That's intentional — fresh setups should over-monitor for the first 1-2 weeks until the auto-tuner suggests reductions after green-run streaks.
  • .claude/skills/context-onboarding/SKILL.md: Let the user invoke the first run on their terms.
  • .claude/skills/context-onboarding/SKILL.md: A fresh install has nothing to migrate and should never see the word.
  • .claude/skills/core-discipline/SKILL.md: **Significant change** (restructure a cluster, create new skills) → use clear-planner, run the full workflow
  • .claude/skills/core-discipline/SKILL.md: | Task Type | Action | | ------------------------- | ---------------------- | | Questions, commands | Respond directly | | Single-file fixes | Just do it | | Small changes (1-3 files) | Think briefly, execute |
  • .claude/skills/core-discipline/SKILL.md: A scheduled dispatcher run finishes clean green with zero findings (one-line summary keeps the dashboard "Ready" status meaningful)
  • .claude/skills/core-discipline/SKILL.md: **Special case — wrapping scripts with built-in prompts** (like `update.py`'s `[y/N]` prompt): invoke the script with `--dry-run` first, parse the output, surface the summary via `AskUserQuestion`, then re-invoke with `--yes` based on the user's choice.
  • .claude/skills/daydream/SKILL.md: If the file doesn't exist, this is the first run — use 2 weeks ago as the baseline.
  • .claude/skills/daydream/SKILL.md: # Read last run timestamp (or default to 2 weeks ago)
  • .claude/skills/daydream/SKILL.md: cat .claude/quality/last-daydream.txt 2>/dev/null || echo "no previous run"
  • .claude/skills/daydream/SKILL.md: git log --since="{last_daydream_date}" --name-only --pretty=format:"%h %s (%ar)" -- docs/ ':!docs/_bcos-framework/methodology/' ':!docs/_bcos-framework/guides/' ':!docs/_bcos-framework/templates/'
  • .claude/skills/daydream/SKILL.md: Report "No document changes since last run" and skip to Phase 3 (Imagine) for forward-looking reflection only.
  • .claude/skills/daydream/SKILL.md: git diff {last_daydream_commit}..HEAD -- docs/path/to/changed-file.md
  • .claude/skills/daydream/SKILL.md: python .claude/scripts/build_document_index.py --dry-run
  • .claude/skills/daydream/SKILL.md: python .claude/scripts/generate_wakeup_context.py
  • .claude/skills/daydream/SKILL.md: **Step 5b: Run maintenance scripts**
  • .claude/skills/daydream/SKILL.md: Daydream is the natural time to run periodic maintenance:
  • .claude/skills/daydream/SKILL.md: python .claude/scripts/prune_sessions.py
  • .claude/skills/daydream/SKILL.md: python .claude/scripts/prune_diary.py
  • .claude/skills/daydream/SKILL.md: python .claude/scripts/generate_wakeup_context.py
  • .claude/skills/daydream/SKILL.md: python .claude/scripts/analyze_crossrefs.py
  • .claude/skills/daydream/SKILL.md: **Step 6: Record this run**
  • .claude/skills/daydream/SKILL.md: python .claude/scripts/record_daydream.py
  • .claude/skills/daydream/SKILL.md: **Document Index** — Run `python .claude/scripts/build_document_index.py` if files changed
  • .claude/skills/doc-lint/SKILL.md: If `.md`: Run markdown quality checks and cross-reference validation
  • .claude/skills/doc-lint/SKILL.md: If `.json`: Run JSON structure validation
  • .claude/skills/doc-lint/SKILL.md: Px_001: Run markdown quality check -> doc-lint (markdown category)
  • .claude/skills/doc-lint/SKILL.md: Px_002: Run example code validation -> doc-lint (cross_reference category)
  • .claude/skills/doc-lint/SKILL.md: Px_001: Run JSON structure validation -> doc-lint (json_structure category)
  • .claude/skills/doc-lint/SKILL.md: Px_002: Run markdown quality check -> doc-lint (markdown category)
  • .claude/skills/ecosystem-manager/SKILL.md: Run discovery to see what exists:
  • .claude/skills/ecosystem-manager/SKILL.md: bash .claude/agents/agent-discovery/find_agents.sh
  • .claude/skills/ecosystem-manager/SKILL.md: bash .claude/skills/skill-discovery/find_skills.sh
  • .claude/skills/ecosystem-manager/SKILL.md: Run it before committing.
  • .claude/skills/ecosystem-manager/SKILL.md: python .claude/scripts/analyze_integration.py --uncommitted
  • .claude/skills/ecosystem-manager/SKILL.md: Coverage gaps in install.sh, settings.json, state.json, .gitignore
  • .claude/skills/ecosystem-manager/SKILL.md: Add fix tasks to the plan and execute them before committing.
  • .claude/skills/ecosystem-manager/SKILL.md: [ ] **install.sh installs new files**
  • .claude/skills/ecosystem-manager/SKILL.md: Run after major development sessions or as part of monthly architecture review.
  • .claude/skills/ecosystem-manager/SKILL.md: Run `python .claude/scripts/wiki_schema.py list` to inspect page-types, lint-checks, and auto-fixes from `_wiki/.schema.yml` or the framework fallback.
  • .claude/skills/ecosystem-manager/SKILL.md: Run all 4 CI checks locally:
  • .claude/skills/ecosystem-manager/SKILL.md: python .github/scripts/validate_frontmatter.py # YAML metadata on all managed markdown
  • .claude/skills/ecosystem-manager/SKILL.md: python .github/scripts/validate_references.py # All registry paths resolve + state.json accuracy
  • .claude/skills/ecosystem-manager/SKILL.md: python .claude/scripts/analyze_integration.py --ci # Ecosystem wiring (install.sh, settings.json coverage)
  • .claude/skills/learning/SKILL.md: **Mechanism:** `python .claude/scripts/promote_resolutions.py` (the module's `__main__` calls `regenerate()`).
  • .claude/skills/learning/SKILL.md: Run the matching subcommand directly.
  • .claude/skills/lessons-consolidate/SKILL.md: python .claude/scripts/consolidate_lessons.py
  • .claude/skills/schedule-dispatcher/SKILL.md: Run `python .claude/scripts/update.py` first."
  • .claude/skills/schedule-dispatcher/SKILL.md: Report to the user: "schedule-config.json is malformed — fix before the dispatcher can run.
  • .claude/skills/schedule-dispatcher/SKILL.md: For each entry in `jobs`, decide if it should run today.
  • .claude/skills/schedule-dispatcher/SKILL.md: | `schedule` value | Runs when | |--------------------|----------------------------------------------------| | `"daily"` | Every day | | `"mon"`..`"sun"` | Only on that weekday …[+549 chars]
  • .claude/skills/schedule-dispatcher/SKILL.md: **For on-demand dispatch** (user said "run the audit-inbox job"): skip this step, run only the named job.
  • .claude/skills/schedule-dispatcher/SKILL.md: Build an ordered list of jobs to run.
  • .claude/skills/schedule-dispatcher/SKILL.md: python .claude/scripts/context_index.py --write
  • .claude/skills/schedule-dispatcher/SKILL.md: The cache TTL is 10 min (longer than a full dispatcher cycle), so all jobs in this run hit the same in-memory snapshot.
  • .claude/skills/schedule-dispatcher/SKILL.md: Last run timestamp per job?
  • .claude/skills/schedule-dispatcher/SKILL.md: Use the helper script — it creates `.claude/hook_state/` on first run and matches the allowlisted command prefix so it never prompts:
  • .claude/skills/schedule-dispatcher/SKILL.md: python .claude/scripts/append_diary.py '{"ts":"2026-04-15T09:04:12","job":"index-health","verdict":"green","findings_count":0,"auto_fixed":[],"actions_needed":[],"duration_s":4}'
  • .claude/skills/schedule-dispatcher/SKILL.md: **Fallback:** when `.bcos-umbrella.json` is absent (standalone BCOS install with no umbrella), preflight reduces to the `../` + absolute-path scans — no sibling-name list to check against.
  • .claude/skills/schedule-dispatcher/SKILL.md: After Step 4 completes (last job returned), verify that **every job listed in Step 2's run-list produced exactly one diary entry in this dispatcher tick**.
  • .claude/skills/schedule-dispatcher/SKILL.md: Read back the diary entries appended during this tick (use the dispatcher's in-memory record, or the tail of `.claude/hook_state/schedule-diary.jsonl` filtered to the current run's `ts` prefix if you're running on-demand).
  • .claude/skills/schedule-dispatcher/SKILL.md: **Added in schema 1.1.0.** Before applying auto-fixes (Step 5) or rendering the digest (Step 7), enrich each finding emitted in Step 4 with three computed fields and produce the run's headline string.
  • .claude/skills/schedule-dispatcher/SKILL.md: **Match against prior tick.** Scan diary entries from the **immediately-prior dispatcher tick** (the most-recent run before today, identified by the latest `ts` < today's run window).
  • .claude/skills/schedule-dispatcher/SKILL.md: | Run shape | Headline template | |---|---| | Green clean (0 findings, 0 framework) | "{Nth consecutive green run.}{recovery callout if any job verdict flipped error→green this tick.}" | | Green with frequency suggestions only | "All {N} jobs green.
  • .claude/skills/schedule-dispatcher/SKILL.md: And the run has a `headline` string ready for Step 7.
  • .claude/skills/schedule-dispatcher/SKILL.md: For each job run today, check recent diary:
  • .claude/skills/schedule-dispatcher/SKILL.md: **Last run was `error`** → suggest investigating, not frequency change
  • .claude/skills/schedule-dispatcher/SKILL.md: Both are overwritten each run.
  • .claude/skills/schedule-dispatcher/SKILL.md: Conditional sections render ONLY when their counts are non-zero — a green clean run is ~5 lines, an amber run with 5 findings is ~40 lines.
  • .claude/skills/schedule-dispatcher/SKILL.md: | 1 | `{emitted_by}` | `{primary_attr}` | {one-line meaning} | {`🔁 Nth run` if consecutive_runs ≥ 3, else blank} |
  • .claude/skills/schedule-dispatcher/SKILL.md: Run at {ISO timestamp} · `.claude/hook_state/schedule-diary.jsonl`
  • .claude/skills/schedule-dispatcher/SKILL.md: verdict emoji + finding count + inline status markers in Note column | | `💡 Suggestions` | `≥1` `frequency-suggestion` finding | Bullet list | | Footer | Always | Run timestamp, diary path, auto-commit status |
  • .claude/skills/schedule-dispatcher/SKILL.md: | Scenario | Verdict bar example | Top line | Action hint | |---|---|---|---| | Green clean | `**🟢 BCOS green** · 1 ran · 0 findings · 0 fixed · 4s` | `Headline string from Step 4c, e.g. "10th consecutive green run."` | `→ Nothing to act on.
  • .claude/skills/schedule-dispatcher/SKILL.md: Run `git rev-parse --abbrev-ref HEAD` to get the current branch.
  • .claude/skills/schedule-dispatcher/SKILL.md: This is the per-tick safety property: a stray hand-edit to a "generated" file on a day its owning job did not run still blocks auto-commit.
  • .claude/skills/schedule-dispatcher/SKILL.md: Globs are resolved against `git status --porcelain` paths (same surface the clean-tree rule already inspects).
  • .claude/skills/schedule-dispatcher/SKILL.md: **Emit the `job-missing-outputs-declaration` framework-finding only when** the job's run would have changed at least one path *outside* `GLOBAL_ALLOWED` (i.e. a path that *could* have been auto-committable had it been declared).
  • .claude/skills/schedule-dispatcher/SKILL.md: Run `git status --porcelain`.
  • .claude/skills/schedule-dispatcher/SKILL.md: `git commit -m "bcos: daily maintenance {YYYY-MM-DD}"` — no push, ever.
  • .claude/skills/schedule-dispatcher/SKILL.md: A BCOS install with no umbrella still writes the log — it just sits locally until somebody (or the dashboard) reads it.
  • .claude/skills/schedule-dispatcher/SKILL.md: The last thing the dispatcher does depends on whether the run produced anything that needs user judgement.
  • .claude/skills/schedule-dispatcher/SKILL.md: Otherwise — clean green run, zero findings, zero suggestions — output a short summary and stop.
  • .claude/skills/schedule-dispatcher/SKILL.md: **Why this rule:** if every run always asked a question, every scheduled run would show as "Awaiting input" in the dashboard even on clean days.
  • .claude/skills/schedule-dispatcher/SKILL.md: Or even shorter when the user is watching an on-demand run:
  • .claude/skills/schedule-dispatcher/SKILL.md: ("Do you want architecture review to run weekly?" is too abstract — `schedule-tune` handles that)
  • .claude/skills/schedule-dispatcher/SKILL.md: **Retry the failed job(s)** → re-run only the errored jobs (on-demand mode), then ask again with the new result
  • .claude/skills/schedule-dispatcher/SKILL.md: If the user says "run the {job-name} job now" or "run today's maintenance now":
  • .claude/skills/schedule-dispatcher/SKILL.md: Skip the schedule predicate — run only the named job(s)
  • .claude/skills/schedule-dispatcher/SKILL.md: ## On-demand run — {HH:MM} ({job-name})
  • .claude/skills/schedule-dispatcher/SKILL.md: If `daily-digest.md` does not yet exist (no scheduled run happened today), create it with a minimal header before appending the on-demand section.
  • .claude/skills/schedule-dispatcher/SKILL.md: DO append a diary entry per job with `"trigger":"on-demand"` so the run is tracked in history
  • .claude/skills/schedule-dispatcher/SKILL.md: Run another job
  • .claude/skills/schedule-dispatcher/SKILL.md: The morning scheduled run always OVERWRITES `daily-digest.md` fresh — so yesterday's on-demand sections are not preserved in the digest (diary retains them).
  • .claude/skills/schedule-dispatcher/SKILL.md: Every dispatcher run produces either a digest OR a user-facing error message.
  • .claude/skills/schedule-dispatcher/SKILL.md: `schedule-tune` — user-facing skill for changing config ("run audit twice a week")
  • .claude/skills/schedule-dispatcher/SKILL.md: If a run was wrong, add a corrective entry, don't mutate history.
  • .claude/skills/schedule-tune/SKILL.md: If you haven't set up BCOS scheduling yet, run `context-onboarding` Step 6.
  • .claude/skills/schedule-tune/SKILL.md: **Utterances:** *"run audit twice a week"*, *"change daydream to every 3 days"*, *"switch architecture review to quarterly"*, *"run index-health on weekdays only"*, *"audit on Tuesdays and Fridays"*
  • .claude/skills/schedule-tune/SKILL.md: **Utterances:** *"run the dispatcher at 08:30"*, *"move morning maintenance to 07:00"*
  • .claude/skills/schedule-tune/SKILL.md: Update the actual scheduled task's cron via `mcp__scheduled-tasks__update_scheduled_task` — that's what actually moves the run
  • .claude/skills/schedule-tune/SKILL.md: **Utterances:** *"what's my maintenance schedule?"*, *"when does audit run?"*, *"is architecture-review enabled?"*
  • .claude/skills/schedule-tune/SKILL.md: If the user proposes a cron that would run more than once per day, refuse: *"Dispatcher is designed to run once daily.
  • .claude/skills/schedule-tune/SKILL.md: | User says | Config edit | |----------------------------------------|----------------------------------------------------------------| | "run audit on Tuesday instead of Friday" | `jobs.audit-inbox.schedu …[+1012 chars]
  • .claude/skills/todo-utilities/SKILL.md: **Sequential Agent Invocation** — Tasks run one after another
  • CLAUDE.md: **Small changes (1-3 files)** — think briefly, execute.
  • CLAUDE.md: Auto-generated by `python .claude/scripts/generate_wakeup_context.py`.
  • CLAUDE.md: When unsure, run `context-ingest` and let it propose the route.
  • CLAUDE.md: **Post-work handoffs:** After integrating new content, offer to (a) rebuild the document index, (b) update related data points, (c) run an audit if architecture shifted.

Hooks (5)

  • .claude/settings.json (Stop): bash "$CLAUDE_PROJECT_DIR/.claude/hooks/auto_save_session.sh"
  • .claude/settings.json (PreCompact): bash "$CLAUDE_PROJECT_DIR/.claude/hooks/precompact_save.sh"
  • .claude/settings.json (PostToolUse): "$CLAUDE_PROJECT_DIR/.claude/bin/python3" "$CLAUDE_PROJECT_DIR/.claude/hooks/post_edit_frontmatter_check.py"
  • .claude/settings.json (PostToolUse): "$CLAUDE_PROJECT_DIR/.claude/bin/python3" "$CLAUDE_PROJECT_DIR/.claude/hooks/post_edit_frontmatter_check.py"
  • .claude/settings.json (PostToolUse): "$CLAUDE_PROJECT_DIR/.claude/bin/python3" "$CLAUDE_PROJECT_DIR/.claude/hooks/post_commit_context_check.py"

Install scripts (1)

  • install.sh: sh install.sh
  • Medium risk: runs-instruction-instruction-network (.claude/agents/wiki-fetch/AGENT.md:93)
  • Medium risk: runs-instruction-instruction-network (.claude/skills/bcos-wiki/SKILL.md:150)
  • Medium risk: runs-instruction-instruction-network (.claude/skills/context-onboarding/SKILL.md:33)
  • Medium risk: runs-instruction-instruction-network (.claude/skills/context-onboarding/SKILL.md:50)
  • Low risk: scripts-present (.claude/agents/agent-discovery/find_agents.sh)
  • Low risk: scripts-present (.claude/bin/python3)
  • Low risk: scripts-present (.claude/hooks/auto_save_session.sh)
  • Low risk: scripts-present (.claude/hooks/post_commit_context_check.py)
  • Low risk: scripts-present (.claude/hooks/post_edit_frontmatter_check.py)
  • Low risk: scripts-present (.claude/hooks/precompact_save.sh)
  • Low risk: scripts-present (.claude/scripts/analyze_crossrefs.py)
  • Low risk: scripts-present (.claude/scripts/analyze_integration.py)
  • Low risk: scripts-present (.claude/scripts/append_diary.py)
  • Low risk: scripts-present (.claude/scripts/audit_node_configs.py)
  • Low risk: scripts-present (.claude/scripts/auto_fix_audit.py)
  • Low risk: scripts-present (.claude/scripts/bcos_inventory.py)
  • Low risk: scripts-present (.claude/scripts/build_document_index.py)
  • Low risk: scripts-present (.claude/scripts/cmd_wiki_archive.py)
  • Low risk: scripts-present (.claude/scripts/cmd_wiki_init.py)
  • Low risk: scripts-present (.claude/scripts/cmd_wiki_lint.py)
  • Low risk: scripts-present (.claude/scripts/cmd_wiki_queue_add.py)
  • Low risk: scripts-present (.claude/scripts/cmd_wiki_remove.py)
  • Low risk: scripts-present (.claude/scripts/cmd_wiki_review.py)
  • Low risk: scripts-present (.claude/scripts/cmd_wiki_search.py)
  • Low risk: scripts-present (.claude/scripts/consolidate_lessons.py)
  • Low risk: scripts-present (.claude/scripts/context_bundle.py)
  • Low risk: scripts-present (.claude/scripts/context_index.py)
  • Low risk: scripts-present (.claude/scripts/context_search.py)
  • Low risk: scripts-present (.claude/scripts/digest_sidecar.py)
  • Low risk: scripts-present (.claude/scripts/find_lessons.py)
  • Low risk: scripts-present (.claude/scripts/generate_wakeup_context.py)
  • Low risk: scripts-present (.claude/scripts/install_global_permissions.py)
  • Low risk: scripts-present (.claude/scripts/lifecycle_sweep.py)
  • Low risk: scripts-present (.claude/scripts/load_task_profiles.py)
  • Low risk: scripts-present (.claude/scripts/load_zone_registry.py)
  • Low risk: scripts-present (.claude/scripts/promote_resolutions.py)
  • Low risk: scripts-present (.claude/scripts/prune_diary.py)
  • Low risk: scripts-present (.claude/scripts/prune_sessions.py)
  • Low risk: scripts-present (.claude/scripts/record_daydream.py)
  • Low risk: scripts-present (.claude/scripts/record_resolution.py)
  • Low risk: scripts-present (.claude/scripts/refresh_ecosystem_state.py)
  • Low risk: scripts-present (.claude/scripts/refresh_wiki_index.py)
  • Low risk: scripts-present (.claude/scripts/run_wiki_canonical_drift.py)
  • Low risk: scripts-present (.claude/scripts/run_wiki_coverage_audit.py)
  • Low risk: scripts-present (.claude/scripts/run_wiki_graveyard.py)
  • Low risk: scripts-present (.claude/scripts/run_wiki_source_refresh.py)
  • Low risk: scripts-present (.claude/scripts/run_wiki_stale_propagation.py)
  • Low risk: scripts-present (.claude/scripts/scan_docs_structure.py)
  • Low risk: scripts-present (.claude/scripts/set_profile.sh)
  • Low risk: scripts-present (.claude/scripts/update.py)

Attribution and licence

First committed by
GitHub avatar of walm00walm00
Publisher
Guntis Coders (Community)
Source
walm00/business-context-os · commit 4635683
Licence
MIT License (files served here)
  • ATTRIBUTION.md (written by AutoGineer)
Synced
Contributors
walm00

AutoGineer is not affiliated with or endorsed by walm00.

Install from source

9 of its files are not served here, so there is no ZIP. walm00/business-context-os at 4635683