Repository navigation
Description
Description
knowledge.py (--digest / --search) indexes project knowledge sources only from a top-level [[knowledge.sources]] array in _bmad/custom/config.toml:
BMAD-METHOD/skills/core-tools/bmad/scripts/knowledge.py
Lines 969 to 1023 in 5d74939
| def collect_custom_knowledge( | |
| project_root: Path | None, | |
| problems: list[dict[str, object]], | |
| ) -> tuple[list[dict[str, object]], list[dict[str, object]]]: | |
| """Load local `_bmad/custom/knowledge/*.md` topics and project `[[knowledge.sources]]`.""" | |
| topic_by_slug: dict[str, dict[str, object]] = {} | |
| if project_root is not None: | |
| proj_dir = project_root / "_bmad" / "custom" / "knowledge" | |
| try: | |
| if proj_dir.is_dir(): | |
| for path in sorted(proj_dir.glob("*.md")): | |
| entry = read_topic_entry(path, proj_dir, "custom", "custom", "custom", problems) | |
| if entry is not None: | |
| topic_by_slug[path.stem] = entry | |
| except OSError: | |
| pass | |
| sources: list[dict[str, object]] = [] | |
| if project_root is not None: | |
| bmad_dir = project_root / "_bmad" | |
| try: | |
| has_bmad = bmad_dir.is_dir() | |
| except OSError: | |
| has_bmad = False | |
| if has_bmad: | |
| try: | |
| cfg = merge_layers(central_config_layers(project_root, require_project=False)) | |
| except ConfigError as error: | |
| problems.append({"kind": "custom_knowledge", "skill": "custom", "problem": str(error)}) | |
| cfg = {} | |
| k_table = cfg.get("knowledge") | |
| raw_sources = k_table.get("sources", []) if isinstance(k_table, dict) else [] | |
| if isinstance(raw_sources, list): | |
| for entry in raw_sources: | |
| if not isinstance(entry, dict): | |
| continue | |
| sid = str(entry.get("id", "")).strip() | |
| when = str(entry.get("when", "")).strip() | |
| how = str(entry.get("how", "")).strip() | |
| if not (sid and when and how): | |
| continue | |
| tags = ( | |
| [str(t).strip() for t in entry.get("tags", []) if isinstance(t, str) and t.strip()] | |
| if isinstance(entry.get("tags"), list) | |
| else [] | |
| ) | |
| agents = ( | |
| [str(a).strip() for a in entry.get("agents", []) if isinstance(a, str) and a.strip()] | |
| if isinstance(entry.get("agents"), list) | |
| else [] | |
| ) | |
| sources.append( | |
| {"id": sid, "when": when, "how": how, "tags": tags, "agents": agents, "owner": "custom"} | |
| ) |
The documented schema is [core.knowledge_sources.<id>], resolved by config_utils.resolve_knowledge_sources, and the config validator rejects a top-level knowledge table:
- **`[core.knowledge_sources.<id>]`** *(read-in)*: Declares where existing team or personal context lives (`kind = "mcp" | "cli" | "path" | "url"`, `target`, optional `tool` matching a detected CLI or `core.tooling.external_services` entry, optional `scope` tags such as `["architecture", "product"]`, `guidance`, and `mode = "active" | "disabled"`). BMAD-METHOD/docs/toolsmith/modules.md
Line 112 in 5d74939
- **Project custom knowledge:** Plain `.md` guides in `_bmad/custom/knowledge/` (same frontmatter: `title`, `when`, `tags`, `related`) and `[core.knowledge_sources.<id>]` entries in `_bmad/custom/config.toml` or `_bmad/custom/config.user.toml` index alongside shipped help automatically.
#3313 moved the docs to the new schema, but knowledge.py was not updated. Only docs/reference/module-files.md still mentions the old form:
BMAD-METHOD/docs/reference/module-files.md
Line 220 in 5d74939
| - **`help/<topic>.md`**: Deep topic guides (either in `bmod-<code>/help/` for cross-cutting guides or `<skill>/help/` for single-skill guides). Each file begins with YAML frontmatter containing `title`, crisp `when`, `tags`, and optional `related` (`<owner>/<topic>`). Teams and users can add their own frontmatter-indexed `.md` guides under `_bmad/custom/knowledge/`, and `[[knowledge.sources]]` tables in `_bmad/custom/config.toml` / `config.user.toml`. See [Write the Help](../toolsmith/modules.md#write-the-help). |
Steps to reproduce
- In a project with
_bmad/, add to_bmad/custom/config.toml:[core.knowledge_sources.eng-wiki] kind = "url" target = "https://wiki.example.com" guidance = "Team ADRs"
- Run
uv run _bmad/scripts/knowledge.py --project-root . --digest. - Optionally add a
[[knowledge.sources]]entry too and runresolve_config.py --project-root . --check.
Expected behavior
eng-wiki is listed under "External & Custom Knowledge" and found by --search, matching resolve_config.py --resolve-sources.
Actual behavior
eng-wiki is missing from the digest. Only a [[knowledge.sources]] entry is indexed, and resolve_config.py --check rejects that same table: "unsupported top-level table knowledge".
Which module is this for?
Core Tools (core-tools)
BMad Version
v7.2.0 (also on dev at 5d74939)
Activity