Skip to content

Commit fd85305

Browse files
Copilotmrjf
andcommitted
Fix agentic-wiki-writer: single push-wiki call and bare pipe in wiki links
Co-authored-by: mrjf <180956+mrjf@users.noreply.github.com>
1 parent d78caf2 commit fd85305

1 file changed

Lines changed: 14 additions & 19 deletions

File tree

workflows/agentic-wiki-writer.md

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -240,11 +240,11 @@ If there is no `source-map.json` (first run), regenerate all pages.
240240

241241
**MANDATORY CONSTRAINTS — read carefully before generating any content:**
242242

243-
- **Never generate more than 4 pages per `push-wiki` call.** If there are more than 4 pages to generate, process them in sequential batches of up to 4, calling `push-wiki` once per batch.
243+
- **Send all wiki pages in a single `push-wiki` call.** Do NOT batch across multiple calls — only one `push-wiki` output is allowed per run.
244244
- **Never spawn a sub-agent or background agent to generate pages.** Generate all pages directly in the main conversation loop.
245245
- **Each page must be kept under 3 KB of markdown.** Keep pages focused and concise.
246-
- **Each `push-wiki` JSON payload must stay under 30 KB total.** If a batch would exceed 30 KB (including the sidebar), split it into a smaller batch.
247-
- **If a `push-wiki` call fails with an API error**, it is likely a timeout caused by a large payload. Retry up to 2 times with progressively smaller batches (halving the batch size each retry, minimum 1 page per call). If a single-page call also fails, the error is unrecoverable — report it and stop.
246+
- **The total `push-wiki` JSON payload must stay under 90 KB.** If the payload would exceed this limit, reduce page content (shorten pages, remove examples) until it fits.
247+
- **If a `push-wiki` call fails with an API error**, it is likely a timeout caused by a large payload. Reduce page content (shorten the longest pages) and retry up to 2 times. If it still fails, the error is unrecoverable — report it and stop.
248248

249249
For each page that needs regeneration:
250250

@@ -264,26 +264,19 @@ Before finalizing each page, review your generated content against the **Self-Re
264264

265265
**Do NOT use sub-agents or background agents for page generation.** Generate all pages directly in the main conversation loop.
266266

267-
Construct wiki page content as strings and pass them to the `push-wiki` safe-output as JSON objects. **Push in batches of at most 4 pages per call** to avoid API timeouts:
267+
Construct wiki page content as strings and pass them to the `push-wiki` safe-output as a **single JSON call containing all pages** (including `_Sidebar.md`). Only one `push-wiki` output is allowed per run — do NOT call `push-wiki` more than once.
268268

269-
1. Divide the full list of pages into batches of up to 4 pages each.
270-
2. For each batch, build a JSON object mapping filenames to markdown content.
271-
3. Include `_Sidebar.md` (generated following the **Sidebar Generation** rules below) **only in the final batch**.
272-
4. Before calling `push-wiki`, estimate the total JSON payload size. **If the payload exceeds 30 KB, reduce the batch size** (use 2 pages per call or fewer) until it fits.
273-
5. Call `push-wiki` once per batch. Proceed to the next batch only after the current call succeeds.
274-
6. **If a `push-wiki` call fails with an API or timeout error**, halve the current batch size (minimum 1 page per call) and retry up to 2 times. API errors during generation are most often caused by large response payloads, not transient network issues. If a single-page call still fails, the error is unrecoverable — report it and stop.
269+
1. Build a single JSON object mapping every filename to its markdown content.
270+
2. Include `_Sidebar.md` (generated following the **Sidebar Generation** rules below) in the same JSON object.
271+
3. Before calling `push-wiki`, estimate the total JSON payload size. **If the payload would exceed 90 KB**, shorten the longest pages (trim examples, reduce prose) until it fits.
272+
4. Call `push-wiki` exactly once with the complete JSON object.
273+
5. **If the `push-wiki` call fails with an API or timeout error**, reduce page content (shorten the longest pages) and retry up to 2 times. If it still fails, the error is unrecoverable — report it and stop.
275274

276-
A single-batch JSON object looks like:
275+
The JSON object looks like:
277276
```json
278277
{
279278
"Home.md": "Welcome to the project...\n\n## Overview\n...",
280-
"Architecture.md": "## System Design\n..."
281-
}
282-
```
283-
284-
The final batch must add the sidebar:
285-
```json
286-
{
279+
"Architecture.md": "## System Design\n...",
287280
"Getting-Started.md": "## Prerequisites\n...",
288281
"_Sidebar.md": "- [[Home|Home]]\n- [[Architecture|Architecture]]\n..."
289282
}
@@ -578,6 +571,8 @@ Determine the correct `OWNER/REPO` and default branch by reading `.git/config` w
578571

579572
**Wiki cross-references** — Use wiki link syntax: `[[Page Name]]` or `[[Display Text|Page-Slug#section-slug]]`.
580573

574+
The `|` separator between display text and slug must be a bare pipe — do NOT backslash-escape it (`[[Control Plane\|Control-Plane]]` is wrong; `[[Control Plane|Control-Plane]]` is correct).
575+
581576
Only link to pages and sections that exist in the PAGES.md template. Use plain text for anything else.
582577

583578
NEVER use `[[display|https://...]]` — that is NOT valid wiki syntax. Use `[display](https://...)` for external URLs.
@@ -600,7 +595,7 @@ Before finalizing each page, check for these issues and fix them:
600595

601596
3. **Heading levels** — No page should start with `#` (H1). Start with content or `##` (H2).
602597

603-
4. **Link format** — Source code links use full GitHub URLs `[text](https://...)`. Wiki cross-references use `[[Page Name]]`. No bare relative paths. No `[[text|https://...]]` syntax.
598+
4. **Link format** — Source code links use full GitHub URLs `[text](https://...)`. Wiki cross-references use `[[Page Name]]` or `[[Display Text|Page-Slug]]` with a bare `|` (never backslash-escaped). No bare relative paths. No `[[text|https://...]]` syntax.
604599

605600
5. **Accuracy** — Content matches what the source code actually does. No fabricated features or APIs.
606601

0 commit comments

Comments
 (0)