From 59b4f9e042ed2b7bf11885a1cd9da7251d5b800d Mon Sep 17 00:00:00 2001 From: Shengyu Fu Date: Sat, 22 Aug 2026 05:33:06 -0700 Subject: [PATCH] Enable Knowledge Base Adds docs manifest, routing index, and sync workflow. --- .github/copilot-instructions.md | 17 +++++++++++ .github/knowledge-base.json | 10 +++++++ .../knowledge-base-issue-artifact.yml | 15 ++++++++++ .github/workflows/knowledge-base.yml | 29 +++++++++++++++++++ AGENTS.md | 17 +++++++++++ docs/index.md | 8 +++++ 6 files changed, 96 insertions(+) create mode 100644 .github/copilot-instructions.md create mode 100644 .github/knowledge-base.json create mode 100644 .github/workflows/knowledge-base-issue-artifact.yml create mode 100644 .github/workflows/knowledge-base.yml create mode 100644 AGENTS.md create mode 100644 docs/index.md diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md new file mode 100644 index 0000000..9c1f0b3 --- /dev/null +++ b/.github/copilot-instructions.md @@ -0,0 +1,17 @@ + +## Knowledge Base + +### Purpose + +This repository uses the Knowledge Base at [https://github.com/microsoft/tgrep](https://github.com/microsoft/tgrep) on branch `main`. + +### Required behavior + +1. Before changing code, read `docs/index.md` from that branch. +2. Use the index to open only the knowledge files relevant to the task. +3. If the index is unavailable, stop and report that the Knowledge Base could not be loaded. + +### Source of truth + +Generated knowledge tracks the code. When the knowledge and code disagree, trust the code. + diff --git a/.github/knowledge-base.json b/.github/knowledge-base.json new file mode 100644 index 0000000..da5d62b --- /dev/null +++ b/.github/knowledge-base.json @@ -0,0 +1,10 @@ +{ + "schema": "2.0", + "docs_system": "tgrep", + "working_repos": [ + { + "repo": "self" + } + ] +} + diff --git a/.github/workflows/knowledge-base-issue-artifact.yml b/.github/workflows/knowledge-base-issue-artifact.yml new file mode 100644 index 0000000..0d64138 --- /dev/null +++ b/.github/workflows/knowledge-base-issue-artifact.yml @@ -0,0 +1,15 @@ +name: Attach Knowledge Base artifact + +on: + issues: + types: [opened] + +permissions: + contents: read + issues: write + +jobs: + attach: + uses: github/agentic-knowledge-base/.github/workflows/attach-issue-artifact-on-open.yml@main + # Guided setup maps KB_ISSUE_ARTIFACT_WRITE_PAT here. + secrets: {} diff --git a/.github/workflows/knowledge-base.yml b/.github/workflows/knowledge-base.yml new file mode 100644 index 0000000..17d8a3a --- /dev/null +++ b/.github/workflows/knowledge-base.yml @@ -0,0 +1,29 @@ +# Keeps the Knowledge Base in sync with the codebase. +# +# Runs daily, when an issue closes, or when started manually. The reusable workflow reads +# .github/knowledge-base.json, updates the knowledge docs, and opens a pull +# request if anything changed. +# +# To change the schedule, edit the cron expression below. + +name: Update Knowledge Base + +on: + schedule: + - cron: "0 8 * * *" + issues: + types: [closed] + workflow_dispatch: {} + +permissions: + actions: read + contents: write + issues: write + pull-requests: write + copilot-requests: write + +jobs: + update-knowledge-base: + uses: github/agentic-knowledge-base/.github/workflows/knowledge-base-engine.lock.yml@main + # Guided setup adds GH_TOKEN or GH_AW_GITHUB_TOKEN here when this repository needs them. + secrets: {} diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..9c1f0b3 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,17 @@ + +## Knowledge Base + +### Purpose + +This repository uses the Knowledge Base at [https://github.com/microsoft/tgrep](https://github.com/microsoft/tgrep) on branch `main`. + +### Required behavior + +1. Before changing code, read `docs/index.md` from that branch. +2. Use the index to open only the knowledge files relevant to the task. +3. If the index is unavailable, stop and report that the Knowledge Base could not be loaded. + +### Source of truth + +Generated knowledge tracks the code. When the knowledge and code disagree, trust the code. + diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 0000000..4bfdee9 --- /dev/null +++ b/docs/index.md @@ -0,0 +1,8 @@ +# microsoft/tgrep + +> Routing index for the knowledge base. Copilot reads this file to decide +> which docs to open for a given task. Keep entries short — one line per doc. + +| When working on | Topics | Read | +|---|---|---| +| Any task in this repo | general | (no docs yet — the sync workflow will populate this table after merge) |