Repository navigation
feat(knowledge): add the repo-tree discovery rung to map-corpus #12305
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
.changes/knowledge/work-resolve-issue-issue-7368-41393858166-1-abe98d31.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| --- | ||
| bump: minor | ||
| --- | ||
|
|
||
| ### Added | ||
|
|
||
| - `/knowledge:map-corpus` can map a repository. Name it as a repository seed pinned to a commit SHA, with `--include` and `--exclude` path globs, and the new `repo-tree` discovery rung lists its files from the forge's tree listing. `parse_discovery.py --rung repo-tree` computes the URL set through a forge adapter (GitHub's fetch steps are in `reference/providers/github/repo-tree.md`). `check_linkmap.py` accepts the rung and passes a corpus whose only seed is a repository seed. The rung and its `repository` record are additions to `discovery-output/v1` and `link-map/v1` (#7368). |
4 changes: 2 additions & 2 deletions
4
plugins/knowledge/evals/mc-resource-seeds-route-away/prompt.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,10 @@ | ||
| --- | ||
| description: "Reaches map-corpus Phase 1 'Resource seed' rule (V1 requires at least one origin seed; resource-seeds-only routes to direct /knowledge:docpage-digest runs): two raw-file seeds and no origin seed. The reply names /knowledge:docpage-digest and the missing origin seed, runs no llms.txt, sitemap, or robots.txt discovery, and writes no link map, manifest, inventory, queue, or handoff. Skill is not granted, so the hand-off is named in the reply rather than invoked." | ||
| description: "Reaches map-corpus Phase 1 'Resource seed' rule (a resource-seeds-only corpus has no discovery basis and routes to direct /knowledge:docpage-digest runs): two raw-file seeds and no origin or repository seed. The reply names /knowledge:docpage-digest and the missing origin seed or discovery basis, runs no llms.txt, sitemap, or robots.txt discovery, and writes no link map, manifest, inventory, queue, or handoff. Skill is not granted, so the hand-off is named in the reply rather than invoked." | ||
| tags: [knowledge, map-corpus, outcome, routing] | ||
| max_turns: 15 | ||
| timeout_seconds: 600 | ||
| allowed_tools: [Bash, Read, Glob, Grep, Write, Edit] | ||
| expected_outcome: "The reply routes the two URLs to /knowledge:docpage-digest and says the mapper needs an origin seed. No Bash command touches llms.txt, a sitemap, or robots.txt, and no Write creates link-map.json, queue.json, manifest.json, inventory.json, or mapper-handoff.md." | ||
| expected_outcome: "The reply routes the two URLs to /knowledge:docpage-digest and says the mapper needs an origin seed or another discovery basis. No Bash command touches llms.txt, a sitemap, or robots.txt, and no Write creates link-map.json, queue.json, manifest.json, inventory.json, or mapper-handoff.md." | ||
| --- | ||
|
|
||
| /knowledge:map-corpus retry-spec https://raw.githubusercontent.com/example-org/retry-spec/main/SPEC.md https://raw.githubusercontent.com/example-org/retry-spec/main/README.md |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| # GitHub repository-tree adapter | ||
|
|
||
| How `/knowledge:map-corpus` reads a GitHub repository for its `repo-tree` discovery rung. The | ||
| skill names the operation; this file holds GitHub's commands. The parsing half is the `github` | ||
| entry in the skill's `discovery/repo_tree_adapters.py`, selected by `parse_discovery.py --forge | ||
| github`. | ||
|
|
||
| ## Pin the ref | ||
|
|
||
| Resolve the branch, tag or SHA the user named to its commit SHA, and record it in the checklist: | ||
|
|
||
| ```bash | ||
| gh api "repos/<owner>/<repo>/commits/<ref>" --jq .sha | ||
| ``` | ||
|
|
||
| The [Get a commit](https://docs.github.com/en/rest/commits/commits#get-a-commit) endpoint takes a | ||
| commit SHA, branch or tag name as `ref` and returns the commit's `sha` (read 2026-11-02). | ||
|
|
||
| ## Snapshot the listing | ||
|
|
||
| ```bash | ||
| gh api "repos/<owner>/<repo>/git/trees/<sha>?recursive=1" > discovery/repo-tree.json | ||
| ``` | ||
|
|
||
| The snapshot is immutable like every other discovery snapshot. Per | ||
| [Get a tree](https://docs.github.com/en/rest/git/trees#get-a-tree) (read 2026-11-02): any value of | ||
| `recursive` returns the whole subtree, each `tree` entry carries `path`, `mode`, `type` and `sha`, | ||
| and a recursive listing is capped at 100,000 entries and 7 MB. Past the cap the response sets | ||
| `truncated` to `true`, and the parser refuses it: a truncated listing is not a complete | ||
| denominator. Stop and ask the user to narrow the corpus. A subtree listing is no substitute, since | ||
| its paths are relative to that subtree and the parser builds URLs from full repository paths. | ||
|
|
||
| The parser keeps entries whose `type` is `blob`. A `tree` entry is a directory and a `commit` | ||
| entry is a submodule; neither is a file to classify. | ||
|
|
||
| ## URLs the adapter builds | ||
|
|
||
| - **Repository seed:** `https://github.com/<owner>/<repo>/tree/<sha>`, the link-map seed and its | ||
| `ignore` row. | ||
| - **Resource URL:** `https://raw.githubusercontent.com/<owner>/<repo>/<sha>/<path>`, with the path | ||
| percent-encoded. The raw form, because a `blob` URL snapshots the HTML page around the file. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.