portable-agent-layer 0.19.0 → 0.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,142 @@
1
+ ---
2
+ name: create-pdf
3
+ description: Generate a structured PDF report from a topic or content using parallel research/writing agents and md-to-pdf. Use when creating a report, generating a PDF, writing a document, or producing a structured multi-section PDF.
4
+ argument-hint: <topic, outline, or content description>
5
+ ---
6
+
7
+ ## Overview
8
+
9
+ Create professional PDF reports by orchestrating parallel subagents for content generation, writing results as structured markdown files, then converting to PDF via `bunx md-to-pdf`.
10
+
11
+ ## Workflow
12
+
13
+ ### Phase 1: Plan the Report Structure
14
+
15
+ Based on the user's request, determine:
16
+
17
+ 1. **Report topic and scope**
18
+ 2. **Section breakdown** — identify 5-15 discrete sections/chapters
19
+ 3. **Output directory** — ask the user or default to `~/Documents/<kebab-case-topic>/`
20
+ 4. **Language** — detect from the user's request or ask
21
+ 5. **File naming** — each section: `YYYYMMDD_snake_case_title.md` (use today's date if no specific date applies)
22
+
23
+ Present the outline to the user for approval before proceeding.
24
+
25
+ ### Phase 2: Parallel Content Generation
26
+
27
+ Spawn **parallel subagents** to write sections simultaneously. Batch sections across agents — each agent handles 2-4 sections depending on total count.
28
+
29
+ **Agent spawning rules:**
30
+ - All agent spawns for a batch MUST be in a **single message** for true parallel execution
31
+ - Each agent gets a clear, self-contained prompt with: section title, scope, key points to cover, tone/style, and the output file path
32
+ - Agents write their sections directly as markdown files
33
+ - For research-heavy reports: use `investigative-researcher`, `multi-perspective-researcher`, and `claude-researcher` agent types to get different perspectives
34
+ - For content-heavy reports: use `general-purpose` agents with detailed writing instructions
35
+
36
+ **Prompt template for each agent:**
37
+ ```
38
+ Read [any reference files if applicable].
39
+ Write a detailed markdown file at [output path] covering:
40
+ - Section title: [title]
41
+ - Scope: [what to cover]
42
+ - Key points: [specific items to include]
43
+ - Tone: [objective/persuasive/technical/casual]
44
+ - Structure: Use ## for main headings, ### for sub-sections
45
+ - Include sources with full URLs where applicable
46
+ ```
47
+
48
+ **Batch sizing guide:**
49
+
50
+ | Total sections | Agents | Sections per agent |
51
+ |----------------|--------|--------------------|
52
+ | 3-6 | 2-3 | 2 each |
53
+ | 7-12 | 3-4 | 2-3 each |
54
+ | 13+ | 5 | 3-4 each |
55
+
56
+ ### Phase 3: Overview File
57
+
58
+ After all agents complete, write a `00_overview.md` file containing:
59
+ - Report title and date
60
+ - Methodology description
61
+ - Table of contents linking to each section
62
+ - Executive summary synthesizing key findings from all sections
63
+
64
+ ### Phase 4: Combine and Convert to PDF
65
+
66
+ **Step 1: Combine all markdown files into one.**
67
+
68
+ Concatenate files in order with page break dividers between sections:
69
+
70
+ ```bash
71
+ cat \
72
+ 00_overview.md \
73
+ <(echo -e '\n\n<div style="page-break-before: always"></div>\n\n---\n\n') \
74
+ YYYYMMDD_section_one.md \
75
+ <(echo -e '\n\n<div style="page-break-before: always"></div>\n\n---\n\n') \
76
+ YYYYMMDD_section_two.md \
77
+ ... \
78
+ > /tmp/combined_raw.md
79
+ ```
80
+
81
+ **Step 2: Add PDF frontmatter.**
82
+
83
+ Prepend YAML frontmatter with styling, then append the combined content:
84
+
85
+ ```bash
86
+ cat > <report_name>.md << 'FRONTMATTER'
87
+ ---
88
+ pdf_options:
89
+ format: A4
90
+ margin: 25mm
91
+ printBackground: true
92
+ stylesheet: https://cdn.jsdelivr.net/npm/github-markdown-css/github-markdown.css
93
+ body_class: markdown-body
94
+ css: |-
95
+ body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif; font-size: 11px; line-height: 1.6; color: #1a1a1a; }
96
+ h1 { font-size: 22px; border-bottom: 2px solid #333; padding-bottom: 8px; }
97
+ h2 { font-size: 17px; }
98
+ h3 { font-size: 14px; }
99
+ table { border-collapse: collapse; width: 100%; margin: 12px 0; }
100
+ th, td { border: 1px solid #ccc; padding: 6px 10px; text-align: left; font-size: 10px; }
101
+ th { background: #f0f0f0; }
102
+ blockquote { border-left: 3px solid #666; padding-left: 12px; color: #444; }
103
+ hr { border: none; border-top: 1px solid #ccc; margin: 20px 0; }
104
+ a { color: #0366d6; text-decoration: none; }
105
+ ---
106
+
107
+ FRONTMATTER
108
+ cat /tmp/combined_raw.md >> <report_name>.md
109
+ ```
110
+
111
+ **Step 3: Generate the PDF.**
112
+
113
+ ```bash
114
+ bunx --bun md-to-pdf <report_name>.md
115
+ ```
116
+
117
+ **Step 4: Verify.**
118
+
119
+ ```bash
120
+ ls -lh <report_name>.pdf
121
+ ```
122
+
123
+ Report the file path and size to the user.
124
+
125
+ ### Phase 5: Translation (Optional)
126
+
127
+ If the user requests translation to another language:
128
+
129
+ 1. Spawn parallel agents (same batching as Phase 2) to translate each markdown file
130
+ 2. Translated files get the same name with a `_<lang>` suffix (e.g., `_hu`, `_de`, `_es`)
131
+ 3. Keep all markdown formatting, links, and structure identical — only translate text content
132
+ 4. Keep source link titles in their original language; translate surrounding descriptive text
133
+ 5. Combine and convert the translated files to PDF using the same Phase 4 process with a `_<lang>` suffix on the final filename
134
+
135
+ ## Important
136
+
137
+ - All subagent spawns for a batch MUST be in a **single message** for true parallel execution
138
+ - Do NOT run agents sequentially — that defeats the purpose of parallel generation
139
+ - Each agent writes its own files directly — the orchestrating agent only combines and converts
140
+ - Always verify the final PDF exists and report its size
141
+ - Use `bunx --bun md-to-pdf` (NOT npx) for PDF conversion
142
+ - Individual markdown files are kept alongside the PDF so the user can edit and regenerate
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "portable-agent-layer",
3
- "version": "0.19.0",
3
+ "version": "0.20.0",
4
4
  "description": "PAL — Portable Agent Layer: persistent personal context for AI coding assistants",
5
5
  "type": "module",
6
6
  "bin": {