Callers want a reviewer that audits code against project-specific design docs. The current action has no way to inject local repo files as context — only external pattern repos via patterns-repo.
The right model: a config file in the caller's repo maps source paths to governing docs. review-bot reads the map, intersects with changed paths in the PR, and injects only the relevant docs. This keeps context surgical — a PR touching one module gets its governing doc, not the entire docs tree.
What
New action input: doc-map
doc-map:description:>- Path to a YAML file mapping source path globs to governing design docs.
review-bot intersects the map with changed PR paths and injects matching
docs as context alongside the diff.required:falsedefault:
Config file format (.review-bot/doc-map.yml in the caller's repo)
paths — glob patterns matched against changed files in the PR diff
docs — local file paths or directories (all .md files under a directory) to inject
Multiple paths entries can map to the same doc; docs are deduplicated
If no paths match, no docs are injected (reviewer runs with system prompt only)
Behavior
Read and parse doc-map file
Get changed file paths from the PR diff
For each mapping, check if any changed path matches any glob in paths
Collect all matching docs, deduplicate
Read each doc file (or all .md files under a directory) from the local checkout
Inject doc content into the system prompt after the system-prompt-file content, under a ## Design Documents heading
If a doc path does not exist, log a warning and skip (do not fail the review)
Context size guard
If total injected doc content exceeds a configurable limit (default: 100KB), truncate with a notice. Prevents accidental context window overflow when a PR touches many modules.
Acceptance criteria
doc-map input added to action.yml
YAML config parsed and validated (unknown keys = warning, not error)
Glob matching against PR changed paths
Docs injected into system prompt under ## Design Documents heading
Directory paths expand to all .md files under that directory
Missing doc paths: warn and skip, do not fail
No matching paths: no docs injected, review runs normally
## Why
Callers want a reviewer that audits code against project-specific design docs. The current action has no way to inject local repo files as context — only external pattern repos via `patterns-repo`.
The right model: a config file in the caller's repo maps source paths to governing docs. review-bot reads the map, intersects with changed paths in the PR, and injects only the relevant docs. This keeps context surgical — a PR touching one module gets its governing doc, not the entire docs tree.
## What
### New action input: `doc-map`
```yaml
doc-map:
description: >-
Path to a YAML file mapping source path globs to governing design docs.
review-bot intersects the map with changed PR paths and injects matching
docs as context alongside the diff.
required: false
default:
```
### Config file format (`.review-bot/doc-map.yml` in the caller's repo)
```yaml
mappings:
- paths:
- "lib/gargoyle/engine/signal_risk/**"
docs:
- docs/domain/contexts/risk/risk-controls.md
- paths:
- "lib/gargoyle/risk/kill_switch/**"
docs:
- docs/domain/contexts/risk/kill-switch.md
- docs/domain/user-lifecycle.md
- paths:
- "lib/gargoyle/trading/**"
docs:
- docs/domain/contexts/trading/
```
- `paths` — glob patterns matched against changed files in the PR diff
- `docs` — local file paths or directories (all `.md` files under a directory) to inject
- Multiple `paths` entries can map to the same doc; docs are deduplicated
- If no paths match, no docs are injected (reviewer runs with system prompt only)
### Behavior
1. Read and parse `doc-map` file
2. Get changed file paths from the PR diff
3. For each mapping, check if any changed path matches any glob in `paths`
4. Collect all matching `docs`, deduplicate
5. Read each doc file (or all `.md` files under a directory) from the local checkout
6. Inject doc content into the system prompt after the `system-prompt-file` content, under a `## Design Documents` heading
7. If a doc path does not exist, log a warning and skip (do not fail the review)
### Context size guard
If total injected doc content exceeds a configurable limit (default: 100KB), truncate with a notice. Prevents accidental context window overflow when a PR touches many modules.
## Acceptance criteria
- [ ] `doc-map` input added to action.yml
- [ ] YAML config parsed and validated (unknown keys = warning, not error)
- [ ] Glob matching against PR changed paths
- [ ] Docs injected into system prompt under `## Design Documents` heading
- [ ] Directory paths expand to all `.md` files under that directory
- [ ] Missing doc paths: warn and skip, do not fail
- [ ] No matching paths: no docs injected, review runs normally
- [ ] Context size guard (configurable, default 100KB)
- [ ] Tests covering: match, no-match, missing file, directory expansion, deduplication
- [ ] CHANGELOG updated
## Example workflow usage
```yaml
- name: AI Review (Doc Adherence)
uses: https://gitea.weiker.me/rodin/review-bot/.gitea/actions/review@<version>
with:
reviewer-token: ${{ secrets.GPT_REVIEW_TOKEN }}
reviewer-name: doc-adherence-reviewer
llm-base-url: http://172.18.0.1:8081/openai/v1
llm-api-key: ${{ secrets.HAI_API_KEY }}
llm-model: gpt-5
doc-map: .review-bot/doc-map.yml
system-prompt-file: .review-bot/system-prompts/doc-adherence.txt
temperature: "0"
timeout: "600"
```
## Related
grgl/gargoyle#778 — the first consumer of this feature
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Why
Callers want a reviewer that audits code against project-specific design docs. The current action has no way to inject local repo files as context — only external pattern repos via
patterns-repo.The right model: a config file in the caller's repo maps source paths to governing docs. review-bot reads the map, intersects with changed paths in the PR, and injects only the relevant docs. This keeps context surgical — a PR touching one module gets its governing doc, not the entire docs tree.
What
New action input:
doc-mapConfig file format (
.review-bot/doc-map.ymlin the caller's repo)paths— glob patterns matched against changed files in the PR diffdocs— local file paths or directories (all.mdfiles under a directory) to injectpathsentries can map to the same doc; docs are deduplicatedBehavior
doc-mapfilepathsdocs, deduplicate.mdfiles under a directory) from the local checkoutsystem-prompt-filecontent, under a## Design DocumentsheadingContext size guard
If total injected doc content exceeds a configurable limit (default: 100KB), truncate with a notice. Prevents accidental context window overflow when a PR touches many modules.
Acceptance criteria
doc-mapinput added to action.yml## Design Documentsheading.mdfiles under that directoryExample workflow usage
Related
grgl/gargoyle#778 — the first consumer of this feature