Skip to content
Draft
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
24 changes: 6 additions & 18 deletions workflows/agentic-wiki-writer.md
Original file line number Diff line number Diff line change
Expand Up @@ -291,11 +291,8 @@ If there is no `source-map.json` (first run), regenerate all pages.

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

- **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.
- **Never spawn a sub-agent or background agent to generate pages.** Generate all pages directly in the main conversation loop.
- **Each page must be kept under 3 KB of markdown.** Keep pages focused and concise.
- **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.
- **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.

For each page that needs regeneration:

Expand All @@ -315,26 +312,17 @@ Before finalizing each page, review your generated content against the **Self-Re

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

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:
Construct wiki page content as strings and pass them to the `push-wiki` safe-output as JSON objects. **Call `push-wiki` exactly once with all pages in a single `files` object** (including `_Sidebar.md`). Multiple `push-wiki` calls are not allowed — the safe-output is capped at 1 invocation per run, and any additional calls will be rejected, silently dropping all pages in those calls.

1. Divide the full list of pages into batches of up to 4 pages each.
2. For each batch, build a JSON object mapping filenames to markdown content.
3. Include `_Sidebar.md` (generated following the **Sidebar Generation** rules below) **only in the final batch**.
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.
5. Call `push-wiki` once per batch. Proceed to the next batch only after the current call succeeds.
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.
1. Build a single JSON object mapping every filename to its markdown content.
2. Include `_Sidebar.md` (generated following the **Sidebar Generation** rules below) in the same object.
3. Pass the entire object to `push-wiki` in one call.

A single-batch JSON object looks like:
A complete JSON object looks like:
```json
{
"Home.md": "Welcome to the project...\n\n## Overview\n...",
"Architecture.md": "## System Design\n..."
}
```

The final batch must add the sidebar:
```json
{
"Architecture.md": "## System Design\n...",
"Getting-Started.md": "## Prerequisites\n...",
"_Sidebar.md": "- [[Home|Home]]\n- [[Architecture|Architecture]]\n..."
}
Expand Down