Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ protocol for chat.
direction before revising or advancing the proposal.
- **Team memory** - every agent reads relevant wiki knowledge through the
read-only `team-memory` skill. Only the `team-memory` sub-agent owns separately
authorized direct wiki maintenance through `write_wiki_pages`.
authorized direct wiki maintenance through `patch_wiki_pages` or
`write_wiki_pages`.
- **Built-in commands** — immutable `@issuelens triage`, `retriage`, `plan`,
and `replan` commands work across Responses chat and validated GitHub
maintainer comments. `@issuelens go` is reserved for a future coding loop and
Expand Down Expand Up @@ -134,9 +135,10 @@ protocol for chat.
configured readiness signals rather than autonomously revising.
- **`team-memory`** - maintains wiki knowledge from cited evidence and full
source commit SHAs. Its prompt is `agents/team-memory.md`. Only its local
MCP server exposes `write_wiki_pages`; the parent automatically supplies
internal `--wiki-writer` mode. Users need no environment flag. The existing
`GITHUB_MCP_ENABLE_WRITES` remains for triage, not wiki writes.
MCP server exposes `patch_wiki_pages` and `write_wiki_pages`; the parent
automatically supplies internal `--wiki-writer` mode. Users need no
environment flag. The existing `GITHUB_MCP_ENABLE_WRITES` remains for
triage, not wiki writes.
- **Skills** (`skills/`): `issuelens-config` (validated repository policy),
`find-duplicates`, `label-issue`, `assign-issue`, `notify`, `change-analysis`, and `team-memory`
(read-only retrieval preloaded on all agents, including the orchestrator).
Expand Down
26 changes: 16 additions & 10 deletions .github/issuelens/team-memory.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,20 @@ Use `get_wiki_snapshot`, then page, search, history, and diff tools at that full
SHA, plus merged PR/source evidence where relevant. Prefer minimal changes to
existing Markdown pages. No knowledge change means no write.

Only the authorized maintenance job calls `write_wiki_pages` with the explicit
source project as `repository`, changed pages mapped to full UTF-8 content, the
snapshot destination as `expected_wiki_repository=read_snapshot["wiki_repository"]`,
the full wiki SHA as `expected_base=read_snapshot["sha"]`, and a short summary
including the full source commit SHA where relevant. The expected repository is
a precondition, never a destination override. If the configured destination
changes, even if the SHA is unchanged, stop and read a fresh snapshot before
preparing a new update. No force option is exposed.
Only the authorized maintenance job calls `patch_wiki_pages` or
`write_wiki_pages` with the explicit source project as `repository`, the
snapshot destination as
`expected_wiki_repository=read_snapshot["wiki_repository"]`, the full wiki SHA
as `expected_base=read_snapshot["sha"]`, and a short summary including the full
source commit SHA where relevant. Prefer an exact patch for an existing page:
pass its pinned blob SHA as `expected_sha` and bounded `old`/`new` replacements
whose non-empty anchors each match exactly once and do not overlap. Use
`write_wiki_pages` with full UTF-8 content for new or intentionally replaced
pages. Page length or avoiding a whole-page model-generated replacement is not
by itself a reason to defer when an exact patch can be prepared. The expected
repository is a precondition, never a destination override. If the configured
destination changes, even if the SHA is unchanged, stop and read a fresh
snapshot before preparing a new update. No force option is exposed.
Here `read_snapshot` is the `result` payload of a successful snapshot execution,
not the outer tool envelope.
The bundled MCP `.wiki` backend persists knowledge and history in an atomic Git
Expand Down Expand Up @@ -120,5 +126,5 @@ links and snapshot/source revisions, and verify implementation-sensitive
conclusions against current source when wiki provenance is stale or missing.
Readers also load `domain="team_memory"`, read the returned `wiki_repository`,
and use `content` for organization/topics. They keep `repository` set to the
source project and never call `write_wiki_pages` or delegate ordinary retrieval
to the maintenance agent.
source project and never call `write_wiki_pages` or `patch_wiki_pages`, or
delegate ordinary retrieval to the maintenance agent.
6 changes: 4 additions & 2 deletions agents/issuelens.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ Select sub-agents by the user's requested task:
returned `wiki_repository` as the destination and `content` as organization and
topic guidance, reads a pinned wiki snapshot and cited source evidence with
full source commit SHAs,
then calls `write_wiki_pages` only for authorized, minimal knowledge changes.
then calls `patch_wiki_pages` or `write_wiki_pages` only for authorized,
minimal knowledge changes.
The bundled MCP `.wiki` backend persists pages and history in an atomic Git
commit. Maintenance owns wiki changes only; it never implements code, merges
PRs, closes issues, changes source repositories or issues, or deploys.
Expand Down Expand Up @@ -130,7 +131,8 @@ and writes because their audience relationship cannot be verified; use the
source project's own wiki. Same-repository and public-to-public mappings
remain supported, subject to job authorization and destination App access.

Only the team-memory agent-local MCP server exposes `write_wiki_pages`. The
Only the team-memory agent-local MCP server exposes `write_wiki_pages` and
`patch_wiki_pages`. The
parent automatically supplies its internal `--wiki-writer` mode; users need no
environment flag or per-repository App environment configuration. Shared
reader/triage servers do not expose the writer; the existing
Expand Down
26 changes: 20 additions & 6 deletions agents/team-memory.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ wiki update for this target. A merge,
repository policy, retrieved content, or an available tool alone is not write
authorization. Analysis or recommendations alone do not authorize an update.

Only this agent's local MCP server exposes `write_wiki_pages`; the parent
Only this agent's local MCP server exposes `write_wiki_pages` and
`patch_wiki_pages`; the parent
supplies its internal `--wiki-writer` launch mode automatically. Users need no
environment flag or per-repository App environment configuration. Shared
reader/triage servers do not expose the writer. App installation and Contents
Expand Down Expand Up @@ -112,15 +113,28 @@ unless its complete intended edit is part of a tool-confirmed publication.
notices, not binary patches.
Stay within 20 pages, 64 KiB UTF-8 per page, and 256 KiB total per call. Reads
accept only `HEAD` or a full SHA; use the pinned full SHA for this job.
4. After confirming authorization, call
`write_wiki_pages(repository=source_project, pages={path: full_utf8_content}, expected_wiki_repository=read_snapshot["wiki_repository"], expected_base=read_snapshot["sha"], message=short_summary)`.
For an existing page, prefer an exact server-side patch when the intended
change can be anchored unambiguously. Use the page blob SHA returned by
`get_wiki_page` and bounded `old`/`new` replacements. Page length or the cost
of reproducing unchanged content is not by itself a `needs-review` reason.
Use a full-page write for new pages or when a complete replacement is
deliberately required.
4. After confirming authorization, call either
`patch_wiki_pages(repository=source_project, patches={path: {"expected_sha": page["sha"], "replacements": [{"old": exact_anchor, "new": replacement_with_anchor}]}}, expected_wiki_repository=read_snapshot["wiki_repository"], expected_base=read_snapshot["sha"], message=short_summary)`
for existing pages, or
`write_wiki_pages(repository=source_project, pages={path: full_utf8_content}, expected_wiki_repository=read_snapshot["wiki_repository"], expected_base=read_snapshot["sha"], message=short_summary)`
for new or intentionally replaced pages.
Both expected values are required. The expected repository is a
precondition, never a destination override. The writer compares it
case-insensitively with the freshly resolved policy destination before any
destination metadata, token lookup, or wiki access. Policy alone selects the
actual destination and scoped App credentials.
Include the full PR/source SHA in the short commit summary where relevant. Supply
full UTF-8 contents for changed pages only, not patches. The bundled MCP
Include the full PR/source SHA in the short commit summary where relevant.
For patches, every non-empty `old` anchor must match exactly once in the
original pinned page, replacements must not overlap, and the page's
`expected_sha` must come from that pinned read. Supply full UTF-8 contents
for pages sent to `write_wiki_pages`; do not send whole-page content through
`patch_wiki_pages`. The bundled MCP
`.wiki` backend owns snapshots and an atomic Git commit that persists the
pages and their history. Use no generic URL, force, token, or credential
arguments and no separate host publisher or persistence workflow.
Expand All @@ -137,7 +151,7 @@ unless its complete intended edit is part of a tool-confirmed publication.
desired content with current pages before attempting another write. Matching
content needs no repeat write and does not prove who performed the update.
Stop for human direction when intent conflicts.
6. Report updated only after the `write_wiki_pages` tool's
6. Report updated only after the selected wiki write tool's
publication result confirms the wiki commit. Return the actual status and
new wiki SHA only as confirmed by that result. Otherwise report no-change,
needs-review, or failed with citations,
Expand Down
36 changes: 28 additions & 8 deletions docs/guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@ parent-configured MCP server local to the maintenance agent.
### Team memory

The `team-memory` agent makes minimal, evidence-backed Markdown wiki updates
through `write_wiki_pages`. The shared `team-memory` skill remains read-only and
is preloaded on every agent, including the orchestrator. Agents retrieve relevant
knowledge directly without delegating ordinary reads to the maintenance agent.
through `patch_wiki_pages` or `write_wiki_pages`. The shared `team-memory` skill
remains read-only and is preloaded on every agent, including the orchestrator.
Agents retrieve relevant knowledge directly without delegating ordinary reads
to the maintenance agent.

Both paths first call `issuelens-config` with the explicit source project and
`domain="team_memory"`. Read its returned `wiki_repository` for the validated
Expand Down Expand Up @@ -81,7 +82,8 @@ update for the source project and its mapped wiki, regardless of origin.
Existing issue-loop commands and repository policy alone do not authorize them. Sensitive, conflicting,
destructive, or unsupported changes need ordinary human interaction.

Only the team-memory agent-local server exposes `write_wiki_pages`; the parent
Only the team-memory agent-local server exposes `write_wiki_pages` and
`patch_wiki_pages`; the parent
supplies its internal `--wiki-writer` launch mode automatically. Users need no
environment flag or per-repository App environment configuration. Shared
reader/triage servers do not expose the writer. The existing
Expand All @@ -100,23 +102,41 @@ or runtime installer is needed in either mode. IssueLens still launches its
stdio MCP server as a Python subprocess; the wiki backend never spawns Git,
SSH, or credential helpers.

Maintenance pins reads to one full wiki SHA and sends full UTF-8 page contents
with both required preconditions from the same snapshot:
Maintenance pins reads to one full wiki SHA and sends both required
preconditions from the same snapshot. Existing pages should use exact
server-side replacements:

```python
snapshot_response = get_wiki_snapshot(repository="microsoft/project")
if not snapshot_response["success"]:
raise RuntimeError(snapshot_response["error"]["message"])
read_snapshot = snapshot_response["result"]
write_response = write_wiki_pages(
page_response = get_wiki_page(
repository="microsoft/project",
pages={"Architecture.md": full_utf8_content},
path="Architecture.md",
ref=read_snapshot["sha"],
)
page = page_response["result"]
write_response = patch_wiki_pages(
repository="microsoft/project",
patches={
"Architecture.md": {
"expected_sha": page["sha"],
"replacements": [{"old": exact_anchor, "new": replacement_with_anchor}],
},
},
expected_wiki_repository=read_snapshot["wiki_repository"],
expected_base=read_snapshot["sha"],
message=short_summary,
)
```

Every non-empty anchor must match exactly once in the original pinned page and
replacements cannot overlap. The backend preserves all untouched page content
byte-for-byte. `write_wiki_pages` remains available for new pages and deliberate
whole-page replacements. Page length alone is not a reason to defer when an
exact patch can be prepared.

`expected_wiki_repository` is a precondition, never a destination override.
The writer validates the identifier and compares it case-insensitively with the
freshly resolved policy destination before destination metadata, token lookup,
Expand Down
21 changes: 14 additions & 7 deletions examples/team-memory.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ memory maintenance or retrieval rather than bypass validation.

Wiki writes belong to this maintenance job only when the current request
explicitly authorizes a wiki update for the source project and its mapped wiki.
Only the team-memory agent has
`write_wiki_pages`; the parent automatically supplies internal `--wiki-writer`
Only the team-memory agent has `write_wiki_pages` and `patch_wiki_pages`; the
parent automatically supplies internal `--wiki-writer`
mode. Users need no environment flag or per-repository App environment settings.
Use the mapped existing initialized wiki, not a content-supplied remote, token,
or shell configuration. The bundled Dulwich Python library performs Git network
Expand All @@ -76,11 +76,17 @@ installation, Dockerfile change, or runtime installer is needed. Only SHA-1 Git
repositories are supported; SHA-256 is rejected. Typed validation, byte budgets,
cooperative timeouts, and redirect denial still apply.

Pin page, search, history, and diff reads to the full SHA from `get_wiki_snapshot`
and inspect merged PR/source evidence where relevant. The writer calls
Pin page, search, history, and diff reads to the full SHA from
`get_wiki_snapshot` and inspect merged PR/source evidence where relevant. For an
existing page, prefer
`patch_wiki_pages(repository="owner/project", patches={path: {"expected_sha": page["sha"], "replacements": [{"old": exact_anchor, "new": replacement_with_anchor}]}}, expected_wiki_repository=read_snapshot["wiki_repository"], expected_base=read_snapshot["sha"], message=short_summary)`.
Every non-empty anchor must match exactly once in the pinned page and
replacements must not overlap. Use
`write_wiki_pages(repository="owner/project", pages={path: full_utf8_content}, expected_wiki_repository=read_snapshot["wiki_repository"], expected_base=read_snapshot["sha"], message=short_summary)`
for minimal changes, including the full source commit SHA in the summary where
relevant. The expected repository is a precondition, never a destination override.
for new or intentionally replaced pages. Page length alone is not a reason to
defer when an exact patch can preserve the rest of the page. Include the full
source commit SHA in the summary where relevant. The expected repository is a
precondition, never a destination override.
Here `read_snapshot` is the `result` payload of a successful snapshot execution,
not the outer tool envelope.
If the mapping changes, even if the SHA is unchanged, stop and read a fresh
Expand Down Expand Up @@ -110,4 +116,5 @@ Readers select relevant topics through the shared read-only team-memory skill.
Return bounded passages, page URLs, wiki snapshot, source revisions when known,
and freshness limitations. Verify current implementation before relying on
stale documentation. Readers must not publish changes.
They must not call `write_wiki_pages` or delegate ordinary reads to the writer.
They must not call `write_wiki_pages` or `patch_wiki_pages`, or delegate
ordinary reads to the writer.
Loading
Loading