hermes-task-framework 1.0.0__py3-none-any.whl
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.
- hermes_task_framework-1.0.0.dist-info/METADATA +7 -0
- hermes_task_framework-1.0.0.dist-info/RECORD +56 -0
- hermes_task_framework-1.0.0.dist-info/WHEEL +5 -0
- hermes_task_framework-1.0.0.dist-info/licenses/LICENSE +1 -0
- hermes_task_framework-1.0.0.dist-info/top_level.txt +1 -0
- task-framework/__init__.py +2 -0
- task-framework/skills/task-external-repos-pattern/SKILL.md +165 -0
- task-framework/skills/task-framework/CHANGELOG.md +45 -0
- task-framework/skills/task-framework/SKILL.md +1365 -0
- task-framework/skills/task-framework/docs/TASKS.md +3 -0
- task-framework/skills/task-framework/docs/architecture.dot +65 -0
- task-framework/skills/task-framework/docs/architecture.svg +188 -0
- task-framework/skills/task-framework/docs/product-requirements.md +65 -0
- task-framework/skills/task-framework/references/auto-runner.md +32 -0
- task-framework/skills/task-framework/references/composites/code-review-session.md +30 -0
- task-framework/skills/task-framework/references/composites/research.md +45 -0
- task-framework/skills/task-framework/references/composites/software-dev.md +41 -0
- task-framework/skills/task-framework/references/document-analysis-workflow.md +95 -0
- task-framework/skills/task-framework/references/file-safety-lesson.md +38 -0
- task-framework/skills/task-framework/references/generating-output-documents.md +166 -0
- task-framework/skills/task-framework/references/operations/code-write.md +30 -0
- task-framework/skills/task-framework/references/operations/document-write.md +185 -0
- task-framework/skills/task-framework/references/operations/info-search.md +27 -0
- task-framework/skills/task-framework/references/operations/web-research.md +57 -0
- task-framework/skills/task-framework/references/policy-time-metadata.md +137 -0
- task-framework/skills/task-framework/references/research-workflow.md +220 -0
- task-framework/skills/task-framework/references/task-format-validation.md +25 -0
- task-framework/skills/task-framework/references/task-hash-naming.md +40 -0
- task-framework/skills/task-framework/references/task-lifecycle-example.md +122 -0
- task-framework/skills/task-framework/references/task-overview-discovery.md +31 -0
- task-framework/skills/task-framework/references/task-types/analysis.md +60 -0
- task-framework/skills/task-framework/references/task-types/external-audit.md +56 -0
- task-framework/skills/task-framework/references/task-types/video-production-pipeline.md +77 -0
- task-framework/skills/task-framework/scripts/__init__.py +0 -0
- task-framework/skills/task-framework/scripts/__pycache__/manage_task.cpython-312.pyc +0 -0
- task-framework/skills/task-framework/scripts/__pycache__/task_ref.cpython-312.pyc +0 -0
- task-framework/skills/task-framework/scripts/__pycache__/update-index.cpython-311.pyc +0 -0
- task-framework/skills/task-framework/scripts/__pycache__/update-index.cpython-312.pyc +0 -0
- task-framework/skills/task-framework/scripts/convert_md_to_pdf.py +236 -0
- task-framework/skills/task-framework/scripts/manage_task.py +442 -0
- task-framework/skills/task-framework/scripts/task-runner.sh +42 -0
- task-framework/skills/task-framework/scripts/task_ref.py +119 -0
- task-framework/skills/task-framework/scripts/update-index.py +293 -0
- task-framework/skills/task-framework/templates/TASK.md +114 -0
- task-framework/skills/task-framework/templates/TASK_MEMORY.md +27 -0
- task-framework/skills/task-framework/templates/run.py +187 -0
- task-framework/skills/task-lifecycle-edge-cases/SKILL.md +84 -0
- task-framework/skills/task-lifecycle-edge-cases/references/task-5d5a1a-recovery-example.md +67 -0
- task-framework/skills/task-lifecycle-portability/SKILL.md +128 -0
- task-framework/skills/task-lifecycle-portability/references/design-session-20260611.md +32 -0
- task-framework/skills/task-lifecycle-portability/references/output-model-design.md +55 -0
- task-framework/skills/task-lifecycle-portability/references/pipeline-output-transition.md +41 -0
- task-framework/skills/task-lifecycle-portability/references/task-recovery-5d5a1a-example.md +27 -0
- task-framework/skills/task-lifecycle-portability/references/task-recovery-procedure.md +63 -0
- task-framework/skills/task-timestamp-convention/SKILL.md +72 -0
- task-framework/skills/task-tracker/SKILL.md +80 -0
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
# Generating Output Documents (Merged Markdown + PDF)
|
|
2
|
+
|
|
3
|
+
When a project task involves converting multiple source documents (DOCX, old-format DOC, XLSX) and merging them into a consolidated output, follow this pattern.
|
|
4
|
+
|
|
5
|
+
## Typical Use Cases
|
|
6
|
+
|
|
7
|
+
- Policy document collection from multiple government sources
|
|
8
|
+
- Competitor analysis report from multiple vendor documents
|
|
9
|
+
- Research paper compilation from multiple papers/drafts
|
|
10
|
+
- Any batch of Chinese-language office documents needing a unified markdown output
|
|
11
|
+
|
|
12
|
+
## Tools
|
|
13
|
+
|
|
14
|
+
| Tool | Purpose | Install |
|
|
15
|
+
|------|---------|---------|
|
|
16
|
+
| `pandoc` | .docx → markdown | System package |
|
|
17
|
+
| `olefile` | Extract text from old .doc (OLE2) | `uv pip install olefile` |
|
|
18
|
+
| `openpyxl` | .xlsx → markdown tables | `uv pip install openpyxl` |
|
|
19
|
+
| `weasyprint` | markdown → PDF | `uv pip install weasyprint` |
|
|
20
|
+
|
|
21
|
+
**Note:** pandoc does NOT support old-format .doc — only .docx. libreoffice is usually not available on servers. olefile extracts readable text directly from the OLE2 binary stream.
|
|
22
|
+
|
|
23
|
+
## Pipeline
|
|
24
|
+
|
|
25
|
+
### Phase 1 — Convert Source Files to Markdown
|
|
26
|
+
|
|
27
|
+
Write a Python script (not inline heredocs — quoting issues guaranteed) that:
|
|
28
|
+
|
|
29
|
+
1. **.docx → markdown** via pandoc subprocess:
|
|
30
|
+
```python
|
|
31
|
+
subprocess.run(["pandoc", str(src), "-f", "docx", "-t", "markdown",
|
|
32
|
+
"--wrap=none"], capture_output=True, text=True, timeout=120)
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
2. **.doc → text** via olefile:
|
|
36
|
+
```python
|
|
37
|
+
ole = olefile.OleFileIO(src_path)
|
|
38
|
+
data = ole.openstream('WordDocument').read()
|
|
39
|
+
# Scan binary data for readable text sequences
|
|
40
|
+
# Filter: ASCII printable 0x20-0x7e, newlines, UTF-8 sequences
|
|
41
|
+
ole.close()
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
3. **.xlsx → markdown table** via openpyxl:
|
|
45
|
+
```python
|
|
46
|
+
wb = openpyxl.load_workbook(src_path, data_only=True)
|
|
47
|
+
for sheet_name in wb.sheetnames:
|
|
48
|
+
ws = wb[sheet_name]
|
|
49
|
+
# Find header row, build markdown table (header + align + rows)
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
**Output:** Each source file → `docs/policy-<sanitized-name>.md` with H1 = original filename, quote block indicating source file, and body text.
|
|
53
|
+
|
|
54
|
+
**Logging:** Each conversion writes to `logs/convert-<name>.log` with pandoc stdout/stderr and exit code.
|
|
55
|
+
|
|
56
|
+
### Phase 2 — Merge Into Comprehensive Document
|
|
57
|
+
|
|
58
|
+
Organize by region/theme with the structure:
|
|
59
|
+
```
|
|
60
|
+
## [[Region]]
|
|
61
|
+
### [Document Name]
|
|
62
|
+
[full text body]
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
1. Define document groups with descriptions
|
|
66
|
+
2. For each group, read the markdown from docs/
|
|
67
|
+
3. Strip auto-generated duplicate headers (h1 + source line)
|
|
68
|
+
4. Insert under the appropriate h2 section header
|
|
69
|
+
5. Generate table of contents
|
|
70
|
+
|
|
71
|
+
### Phase 3 — Generate Summary + Time Annotations
|
|
72
|
+
|
|
73
|
+
When the source documents are policies or regulatory filings, extract and annotate time metadata:
|
|
74
|
+
|
|
75
|
+
- **Policy validity periods** — title-embedded ranges (e.g. "2025—2027年")
|
|
76
|
+
- **Milestone targets** — "到2027年" goals (bed counts, coverage rates, etc.)
|
|
77
|
+
- **Effective/enforcement dates** — "自...起施行" or "印发之日起"
|
|
78
|
+
- **Application deadlines** — "于...前报送" or "申报截止"
|
|
79
|
+
- **Funding/subsidy cutoffs** — per-item expiration dates
|
|
80
|
+
- **Project execution periods** — "实施周期不超过3年" clauses
|
|
81
|
+
|
|
82
|
+
Add a `> **发文:** ... | **文号:** ... | **目标节点:** ...` line after each h3 policy heading in the merged document. See `references/policy-time-metadata.md` for the full category breakdown.
|
|
83
|
+
|
|
84
|
+
### Phase 4 — Generate Summary + PDF
|
|
85
|
+
|
|
86
|
+
1. Write `summary.md` with: overview, per-group summary tables, cross-cutting theme analysis, key data points, and the time metadata section.
|
|
87
|
+
|
|
88
|
+
2. Convert to PDF via markdown → HTML → weasyprint. **CRITICAL: Pandoc's default HTML5 output does NOT produce a full HTML document.** Without `--standalone` / `-s`, pandoc outputs only body content — no `<html>`, `<head>`, or `<style>` tags. CSS injection via `</head>` replacement **fails silently**, and weasyprint falls back to a font without CJK glyphs → garbled PDF.
|
|
89
|
+
|
|
90
|
+
**The Fix — Always wrap pandoc output in a complete HTML document:**
|
|
91
|
+
|
|
92
|
+
```python
|
|
93
|
+
import subprocess
|
|
94
|
+
from pathlib import Path
|
|
95
|
+
|
|
96
|
+
md_path = Path("summary.md")
|
|
97
|
+
pdf_path = Path("summary.pdf")
|
|
98
|
+
|
|
99
|
+
# Step 1: Get body HTML from pandoc (capture stdout, no -o flag)
|
|
100
|
+
result = subprocess.run(
|
|
101
|
+
["pandoc", str(md_path), "-f", "markdown", "-t", "html5",
|
|
102
|
+
"--wrap=none", "--quiet"],
|
|
103
|
+
capture_output=True, text=True, timeout=30
|
|
104
|
+
)
|
|
105
|
+
body_html = result.stdout
|
|
106
|
+
|
|
107
|
+
# Step 2: Wrap in full HTML document with CSS
|
|
108
|
+
full_html = f"""<!DOCTYPE html>
|
|
109
|
+
<html lang="zh-CN">
|
|
110
|
+
<head>
|
|
111
|
+
<meta charset="utf-8">
|
|
112
|
+
<title>{title}</title>
|
|
113
|
+
<style>
|
|
114
|
+
@page {{ size: A4; margin: 2cm; }}
|
|
115
|
+
body {{ font-family: 'WenQuanYi Zen Hei', 'Noto Sans CJK SC', sans-serif;
|
|
116
|
+
font-size: 11pt; line-height: 1.7; }}
|
|
117
|
+
h1 {{ font-size: 20pt; color: #1a3a5c; border-bottom: 2px solid #1a3a5c; }}
|
|
118
|
+
h2 {{ font-size: 16pt; color: #2a5a8c; margin-top: 24px; }}
|
|
119
|
+
table {{ border-collapse: collapse; width: 100%; }}
|
|
120
|
+
th, td {{ border: 1px solid #aaa; padding: 6px 10px; }}
|
|
121
|
+
th {{ background-color: #e8f0f8; }}
|
|
122
|
+
</style>
|
|
123
|
+
</head>
|
|
124
|
+
<body>
|
|
125
|
+
{body_html}
|
|
126
|
+
</body>
|
|
127
|
+
</html>"""
|
|
128
|
+
|
|
129
|
+
# Step 3: Write temp HTML and convert
|
|
130
|
+
html_path = pdf_path.with_suffix('.html')
|
|
131
|
+
html_path.write_text(full_html, encoding='utf-8')
|
|
132
|
+
subprocess.run(["weasyprint", str(html_path), str(pdf_path)], timeout=60)
|
|
133
|
+
html_path.unlink()
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
**Alternative — Python markdown renderer (for large files):** When the merged markdown exceeds 500KB / 4000+ lines, pandoc may timeout. Use `scripts/convert_md_to_pdf.py` instead:
|
|
137
|
+
```bash
|
|
138
|
+
uv run scripts/convert_md_to_pdf.py <input.md> <output.pdf>
|
|
139
|
+
```
|
|
140
|
+
This script has its own markdown→HTML renderer that handles Chinese headings, pipe tables, blockquotes, lists, code blocks, and `---` horizontal rules without pandoc's YAML issue.
|
|
141
|
+
|
|
142
|
+
3. **Font Requirements:** This system has `WenQuanYi Zen Hei` at `/usr/share/fonts/truetype/wqy/wqy-zenhei.ttc`. The CSS font-family MUST list this font first. Do NOT use:
|
|
143
|
+
- `Noto Sans CJK SC` (not installed)
|
|
144
|
+
- `Source Han Sans SC` (not installed)
|
|
145
|
+
- `SimSun` (not installed)
|
|
146
|
+
- `Microsoft YaHei` (not installed)
|
|
147
|
+
These fail silently and produce garbled output.
|
|
148
|
+
|
|
149
|
+
4. **Keep both .md and .pdf.** Delete the intermediate .html.
|
|
150
|
+
|
|
151
|
+
### Phase 5 — Verify PDF Output
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
pdftotext output.pdf - | head -20
|
|
155
|
+
# Expected: clean Chinese like "政策文件汇编 — 摘要"
|
|
156
|
+
# Bad: garbled like "æ”¿ç–æ–‡ä»¶æ±‡ç¼–" (font or CSS wrapping issue)
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
## Pitfalls
|
|
160
|
+
|
|
161
|
+
- **Chinese vs English `政策`/`policy` prefix mismatch** — the conversion script saves files as `policy-<name>.md` but the merge script may look for `政策-<name>.md`. The `policy-` prefix (English) is correct — align all keys with actual filenames.
|
|
162
|
+
- **.doc binary extraction is lossy** — olefile extracts raw text from the WordDocument stream, which may include metadata, lose formatting, or produce fragments. Always note in the merged doc: "从旧格式 .doc 提取,格式可能不完整".
|
|
163
|
+
- **Pandoc timeout** — large files (>500KB) can take >30s via stdin. Set timeout to at least 120s or use `scripts/convert_md_to_pdf.py`.
|
|
164
|
+
- **Markdown anchor links** — Chinese characters in TOC anchors may not work in all renderers. For pandoc compatibility, ASCII-only anchors are safer.
|
|
165
|
+
- **Memory pressure** — 16+ documents merged can exceed 500K chars. Keep the summary small; the full merged file is for reference.
|
|
166
|
+
- **`---` horizontal rule = YAML parse exception** — pandoc interprets `---` lines as YAML metadata block delimiters, even with `-f markdown`. Replace with `<hr>` or use the Python renderer script.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Operation: code-write
|
|
2
|
+
|
|
3
|
+
Implement a feature or fix in code, with tests.
|
|
4
|
+
|
|
5
|
+
## Workflow
|
|
6
|
+
|
|
7
|
+
1. **Understand the requirement** — read TASK.md, PRD/TRD, existing code patterns
|
|
8
|
+
2. **Plan** — what files need changing, in what order (data → logic → UI)
|
|
9
|
+
3. **Write tests first** (TDD) — red phase
|
|
10
|
+
4. **Implement** — make tests pass (green)
|
|
11
|
+
5. **Refactor** — clean up duplication, naming, structure
|
|
12
|
+
6. **Verify** — run test suite, manual smoke test if applicable
|
|
13
|
+
|
|
14
|
+
## Input
|
|
15
|
+
|
|
16
|
+
- Task description or PRD section
|
|
17
|
+
- Existing codebase to integrate with
|
|
18
|
+
|
|
19
|
+
## Output
|
|
20
|
+
|
|
21
|
+
- Changed source files
|
|
22
|
+
- Passing test suite
|
|
23
|
+
- Updated TASK.md checklist
|
|
24
|
+
|
|
25
|
+
## Pitfalls
|
|
26
|
+
|
|
27
|
+
- Skipping test design — TDD exists because it works. Don't skip red phase.
|
|
28
|
+
- Over-engineering — implement the simplest thing that works first, then refactor.
|
|
29
|
+
- Missing edge cases — nulls, empties, boundaries, error states.
|
|
30
|
+
- Commit message convention — use `feat:` / `fix:` based on file functional role (skills/rules → feat, even if .md).
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
# document-write — 编写结构化文档
|
|
2
|
+
|
|
3
|
+
## When to Use
|
|
4
|
+
|
|
5
|
+
编写产品/技术类文档,包括但不限于:
|
|
6
|
+
- 产品需求文档 (PRD) — 做什么、为什么
|
|
7
|
+
- 产品设计文档 — 用户看到什么、怎么交互
|
|
8
|
+
- 技术需求文档 (TRD) — 技术约束、架构模式
|
|
9
|
+
- 技术设计文档 — 代码怎么实现
|
|
10
|
+
|
|
11
|
+
## Four-Document Pattern
|
|
12
|
+
|
|
13
|
+
For feature-level work, the user prefers a **four-document split** (an evolution of the original PRD+TRD pair):
|
|
14
|
+
|
|
15
|
+
| Doc | Content | Audience |
|
|
16
|
+
|-----|---------|----------|
|
|
17
|
+
| **产品需求** (PRD) | 功能描述、用户故事、优先级、需求来源 | 产品/业务 |
|
|
18
|
+
| **产品设计** | 布局图(ASCII)、交互流程、视觉规范、颜色方案、组件状态 | 设计师/前端 |
|
|
19
|
+
| **技术需求** (TRD) | 架构模式、数据模型、状态管理、API 定义、技术约束 | 后端/架构 |
|
|
20
|
+
| **技术设计** | 组件结构、代码实现细节、CSS 模式、已知问题清单 | 开发实施 |
|
|
21
|
+
|
|
22
|
+
### Relationships
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
产品需求 ──说明→ 产品设计
|
|
26
|
+
│ │
|
|
27
|
+
解释"为什么" 解释"怎么用"
|
|
28
|
+
│ │
|
|
29
|
+
▼ ▼
|
|
30
|
+
技术需求 ──约束→ 技术设计
|
|
31
|
+
(具体实现)
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### File Naming
|
|
35
|
+
|
|
36
|
+
Project-level naming convention:
|
|
37
|
+
```
|
|
38
|
+
docs/
|
|
39
|
+
├── product-requirements.md ← 产品需求 (PRD)
|
|
40
|
+
├── sales-product-design.md ← 产品设计
|
|
41
|
+
├── technical-requirements.md ← 技术需求 (TRD)
|
|
42
|
+
└── sales-technical-design.md ← 技术设计
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
For domain-specific modules, prefix with module name: `sales-*`, `product-*`, etc.
|
|
46
|
+
|
|
47
|
+
### Versioning
|
|
48
|
+
|
|
49
|
+
Each doc should have a header block:
|
|
50
|
+
```markdown
|
|
51
|
+
> **版本:** v0.1
|
|
52
|
+
> **状态:** 前端已实现(Mock 数据)
|
|
53
|
+
> **最后修改:** 2026-06-04
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Layout Visualization
|
|
57
|
+
|
|
58
|
+
For UI/UX documents, use ASCII-art tree diagrams to show layout structure. Use Unicode box-drawing characters for column layouts:
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
┌─────────────────────┬──────────────────────────┐
|
|
62
|
+
│ Left (2/3) │ Right (1/3) │
|
|
63
|
+
│ │ ┌─ Panel A (2/3) ─────┐ │
|
|
64
|
+
│ Content here │ │ ... │ │
|
|
65
|
+
│ │ └─────────────────────┘ │
|
|
66
|
+
│ │ ┌─ Panel B (1/3) ─────┐ │
|
|
67
|
+
│ │ │ ... │ │
|
|
68
|
+
│ │ └─────────────────────┘ │
|
|
69
|
+
└─────────────────────┴──────────────────────────┘
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
For tighter representations, use ASCII tree diagrams:
|
|
73
|
+
|
|
74
|
+
```
|
|
75
|
+
└─ order-left (flex column)
|
|
76
|
+
├─ order-top-half (flex:1)
|
|
77
|
+
│ ├─ section-title
|
|
78
|
+
│ ├─ search input
|
|
79
|
+
│ └─ product-list (flex:1, scroll)
|
|
80
|
+
└─ order-bottom-half (flex:1, border-top)
|
|
81
|
+
├─ section-title
|
|
82
|
+
└─ selected-list (flex:1, scroll)
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Standard Tables
|
|
86
|
+
|
|
87
|
+
Use pipe tables in the following standardized formats:
|
|
88
|
+
|
|
89
|
+
### Component/Property Specs
|
|
90
|
+
```markdown
|
|
91
|
+
| 元素 | 字号 | 粗细 | 圆角 |
|
|
92
|
+
|------|------|------|------|
|
|
93
|
+
| 面板头部 | 13px | 600 | — |
|
|
94
|
+
| 建议标签 | 10px | 600 | 4px |
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Color/Variable Specs
|
|
98
|
+
```markdown
|
|
99
|
+
| 用途 | CSS 变量 / 值 | 说明 |
|
|
100
|
+
|------|--------------|------|
|
|
101
|
+
| 背景(画布) | `var(--chakra-colors-bg-canvas, #fff)` | 纯白底 |
|
|
102
|
+
| 文字(默认) | `var(--chakra-colors-fg-default, #1a202c)` | 正文 |
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### API Endpoints
|
|
106
|
+
```markdown
|
|
107
|
+
| 方法 | 端点 | 说明 |
|
|
108
|
+
|------|------|------|
|
|
109
|
+
| GET | `/api/sales/leads` | 潜客列表 |
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Data Models
|
|
113
|
+
```markdown
|
|
114
|
+
| 字段 | 类型 | 说明 |
|
|
115
|
+
|------|------|------|
|
|
116
|
+
| id | string | 主键 |
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## Integration with software-dev Composite
|
|
120
|
+
|
|
121
|
+
The `document-write` operation appears in the `software-dev` composite pattern at step 2:
|
|
122
|
+
|
|
123
|
+
```
|
|
124
|
+
0. [git] Pre-Change Sync
|
|
125
|
+
1. info-search → 调研现有方案
|
|
126
|
+
2. document-write → 写 PRD/TRD + 产品设计/技术设计
|
|
127
|
+
3. code-write → 实现(TDD)
|
|
128
|
+
4. code-review → 审查
|
|
129
|
+
5. [git] Post-Change Workflow
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
For feature work that's already implemented (docs-as-built, not docs-as-spec), write all four docs together to capture the complete design intent for future maintenance.
|
|
133
|
+
|
|
134
|
+
## Functional Semantics Requirement
|
|
135
|
+
|
|
136
|
+
**Every element described in a document must include its functional semantics** — the purpose, intent, and behavior, not just a label or position. This ensures the doc is usable for future reference and verification, not just a build checklist.
|
|
137
|
+
|
|
138
|
+
### What to include per element type
|
|
139
|
+
|
|
140
|
+
| Element type | Must include | Good example | Poor example |
|
|
141
|
+
|-------------|-------------|-------------|-------------|
|
|
142
|
+
| **Button** | What happens on click, what triggers it, what outcome for user | "🔍预览 — 根据当前已选产品动态生成订单详情+收款码组合图片并在浮层展示。用于让销售在发送前确认内容排版和金额正确。" | "预览按钮,弹出浮层" |
|
|
143
|
+
| **Tab / Sub-tab** | What content, when visible, what user goal | "AI对话 — 三栏布局:左侧聊天界面(销售↔AI交流),右侧历史记录(按渠道分组)+ AI分析建议。用于快速记录客户跟进、查看历史对话。" | "AI对话 tab" |
|
|
144
|
+
| **Display area / panel** | What data, what user can do, why it exists | "收款码下方独立操作卡片:包含4个操作按钮,用于对已生成的订单图片进行预览确认、发送给客户、复制到剪贴板或下载保存。" | "收款码下方有操作按钮" |
|
|
145
|
+
| **Interaction** | Full cause-effect chain: user action → system action → user sees | "点击待办事项 → 系统通过openLead将该潜客加入已打开列表,setActiveView切换到潜客管理或客户管理,右侧详情面板同步打开。" | "点击待办跳转到详情" |
|
|
146
|
+
| **Permission / visibility rule** | Who can see it, when it appears, when hidden | "数据显示子tab — 仅role===admin的销售员可见。非管理员看不到该tab按钮,也不影响其他视图。" | "管理员可见" |
|
|
147
|
+
|
|
148
|
+
### Why it matters
|
|
149
|
+
1. **Future verification**: A new developer (or the same agent in a future session) should understand what a feature is supposed to DO, not just where it RENDERS.
|
|
150
|
+
2. **Cross-reference with implementation**: Detailed semantics make it possible to detect drift between spec and code. "预览弹出浮层" vs "预览动态生成图片并弹窗展示" — the latter is testable, the former is vague.
|
|
151
|
+
3. **Design iteration**: When the user says "the meaning of this button should be clearer", the doc should already contain the semantic description so the conversation starts from a shared understanding.
|
|
152
|
+
|
|
153
|
+
### Integration into the workflow
|
|
154
|
+
|
|
155
|
+
When writing or updating any of the four docs:
|
|
156
|
+
1. For every new button, tab, panel, or interaction being described, write its functional semantics in the same pass
|
|
157
|
+
2. When reading an existing doc, note where semantic descriptions are missing — these become qualified items for the "待完善事项" table
|
|
158
|
+
3. Do NOT defer semantics to a later cleanup step — the doc is not complete until every user-facing element has a "why" or "what happens" description
|
|
159
|
+
|
|
160
|
+
## Cross-Referencing with Session History
|
|
161
|
+
|
|
162
|
+
When writing "as-built" docs for work already implemented, use the `conversation-message-list` skill to review the actual conversation and extract the precise set of changes:
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
# Get the session ID for the relevant conversation
|
|
166
|
+
hermes sessions list
|
|
167
|
+
|
|
168
|
+
# Show compact Q&A history (no tool calls)
|
|
169
|
+
python3 ~/.hermes/skills/hermes/conversation-message-list/scripts/list-messages.py <session_id>
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
This gives a tool-call-free list of every user question and final answer, which maps directly to feature requirements and design decisions.
|
|
173
|
+
|
|
174
|
+
## Pitfalls
|
|
175
|
+
|
|
176
|
+
| Pitfall | Correction |
|
|
177
|
+
|---------|------------|
|
|
178
|
+
| Writing only PRD without design/tech docs | Split into all four to cover product + implementation perspectives |
|
|
179
|
+
| ASCII diagrams with ambiguous proportion | Mark flex ratios explicitly (`flex: 2` / `flex: 1`) in the diagram caption |
|
|
180
|
+
| Ignoring user feedback-coupling | Use feedback-station skill to cross-reference doc sections with user feedback IDs |
|
|
181
|
+
| Doc status unchanged after implementation | Update status from "需求讨论中" to actual development phase |
|
|
182
|
+
| No known-issues section in tech design | Always include a backlog/Known Issues table to track gaps |
|
|
183
|
+
| Overwriting existing PRD structure | Read existing doc first, then append/update sections — don't rewrite from scratch |
|
|
184
|
+
| Writing docs from memory instead of session replay | Use `conversation-message-list` skill to re-read the actual conversation for accurate change scope |
|
|
185
|
+
| Forgetting to update sibling docs | When any one doc changes, check and update all four — they form a coherent set |
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Operation: info-search
|
|
2
|
+
|
|
3
|
+
Multi-source information search and capture — competitor analysis, policy research, tech stack evaluation.
|
|
4
|
+
|
|
5
|
+
## Workflow
|
|
6
|
+
|
|
7
|
+
1. **Identify search targets** — competitors, products, papers, policies
|
|
8
|
+
2. **Collect from each source** — web_search, arXiv, policy databases
|
|
9
|
+
3. **Write findings** — one markdown file per source in `tasks/<ts>.<name>/docs/`
|
|
10
|
+
4. **Tag sources** — note date, source URL, confidence level
|
|
11
|
+
5. **Update README.md** — add summary table of collected docs
|
|
12
|
+
|
|
13
|
+
## Input
|
|
14
|
+
|
|
15
|
+
- List of search queries or targets
|
|
16
|
+
- Domain context (industry, technology area)
|
|
17
|
+
|
|
18
|
+
## Output
|
|
19
|
+
|
|
20
|
+
- `docs/*.md` — one file per source
|
|
21
|
+
- Updated `README.md` with collected-docs summary table
|
|
22
|
+
|
|
23
|
+
## Pitfalls
|
|
24
|
+
|
|
25
|
+
- Blind trust in one source — cross-validate with multiple searches
|
|
26
|
+
- Missing search freshness — note date of retrieval
|
|
27
|
+
- Scope creep — agree on search scope before starting
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Operation: web-research
|
|
2
|
+
|
|
3
|
+
单站或多站网页调研 — 读取 URL 内容、提取关键信息、生成结构化摘要。
|
|
4
|
+
|
|
5
|
+
## 适用场景
|
|
6
|
+
|
|
7
|
+
- 竞品官网分析
|
|
8
|
+
- 产品/服务调研
|
|
9
|
+
- 技术文档速读
|
|
10
|
+
- 含截图附件的综合调研
|
|
11
|
+
|
|
12
|
+
## Workflow
|
|
13
|
+
|
|
14
|
+
1. **解析调研目标** — 从 TASK.md 或对话中获取 URL 列表和调研目的
|
|
15
|
+
2. **读取网页内容** — 对每个 URL:
|
|
16
|
+
- 首选 curl(纯文本/API 端点,如 .md/.json/.yaml)
|
|
17
|
+
- 次选 browser_navigate(富交互页面)
|
|
18
|
+
3. **处理附件** — 扫描 `input/` 目录,对截图/图片执行 OCR(tesseract)
|
|
19
|
+
4. **整理摘要** — 统一写入 `output/summary.md`
|
|
20
|
+
5. **内容讨论** — 讨论纪要写入 `output/discuss.md`
|
|
21
|
+
|
|
22
|
+
## 典型 Checklist
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
- [x] Phase 1 — 读取 <url1> 内容
|
|
26
|
+
- [x] Phase 2 — 读取 <url2> 内容
|
|
27
|
+
- [x] Phase 3 — 处理 input/ 附件(OCR)
|
|
28
|
+
- [x] Phase 4 — 保存 summary 到 output/summary.md
|
|
29
|
+
- [x] Phase 5 — 保存内容讨论到 output/discuss.md
|
|
30
|
+
- [ ] BREAK: 确认产出物是否符合要求
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Input
|
|
34
|
+
|
|
35
|
+
- URL 列表(由 TASK.md 或用户指定)
|
|
36
|
+
- `input/` 中的截图/图片(可选)
|
|
37
|
+
|
|
38
|
+
## Output
|
|
39
|
+
|
|
40
|
+
- `output/summary.md` — 结构化调研摘要(含来源标注)
|
|
41
|
+
- `output/discuss.md` — 仅限调研内容本身的后续讨论
|
|
42
|
+
|
|
43
|
+
## 工具链
|
|
44
|
+
|
|
45
|
+
| 步骤 | 工具 |
|
|
46
|
+
|------|------|
|
|
47
|
+
| 网页读取 | `curl`(纯文本)、`browser_navigate` + `browser_console`(富页面) |
|
|
48
|
+
| 图片 OCR | `tesseract`(`-l eng+chi_sim`)|
|
|
49
|
+
| 文件保存 | `write_file` 到 `output/` |
|
|
50
|
+
|
|
51
|
+
## Pitfalls
|
|
52
|
+
|
|
53
|
+
- **不保存网页原始内容** — 除非用户明确要求,summary 已提炼关键信息,避免冗余存档
|
|
54
|
+
- **discuss.md 只放内容讨论** — 任务元讨论(skill/pipeline 设计)是对话内容,不放任务产出物
|
|
55
|
+
- **OCR 可能不准** — 中文截图建议用 `chi_sim` 语言包;多语言混排用 `eng+chi_sim`
|
|
56
|
+
- **内容重复** — 多个页面可能有重叠信息,summary 中应去重合并
|
|
57
|
+
- **区分 summary 和 discuss** — summary 是调研结论(客观),discuss 是后续分析和疑问(主观)
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
# Policy / Regulatory Document Time Metadata Extraction
|
|
2
|
+
|
|
3
|
+
When processing a batch of policy or regulatory documents, extract and categorize all time-related information. This enables chronological analysis, deadline tracking, and compliance planning.
|
|
4
|
+
|
|
5
|
+
## Time Metadata Categories
|
|
6
|
+
|
|
7
|
+
### 1. Title-Embedded Period (标题自带周期)
|
|
8
|
+
|
|
9
|
+
Some policies declare their validity period in the title itself. These are the most visible:
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
浙江省加快推动"人工智能+医疗健康"高质量发展行动计划(2025—2027年)
|
|
13
|
+
重庆市智慧医疗装备产业创新发展行动计划(2025—2027年)
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
**Extraction pattern:** grep for parenthesized year ranges in document titles. Regex: `(\d{4}—\d{4}年)`
|
|
17
|
+
|
|
18
|
+
### 2. Target Milestone ("到 X 年" goals)
|
|
19
|
+
|
|
20
|
+
Almost every policy includes specific quantitative targets with a deadline year. These drive execution priorities.
|
|
21
|
+
|
|
22
|
+
| Pattern | Example |
|
|
23
|
+
|---------|---------|
|
|
24
|
+
| "到 2027 年,……" | 到 2027 年,适老化改造累计完成不少于 12 万户 |
|
|
25
|
+
| "到 2026 年……;到 2027 年……" | 分阶段目标(如 AI 普及率 70% → 80%) |
|
|
26
|
+
|
|
27
|
+
**Extraction:** grep for `到 \d{4} 年` and collect the subsequent metric + value.
|
|
28
|
+
|
|
29
|
+
### 3. Effective / Enforcement Date (施行日期)
|
|
30
|
+
|
|
31
|
+
When the policy takes legal effect:
|
|
32
|
+
|
|
33
|
+
| Source | Examples |
|
|
34
|
+
|--------|----------|
|
|
35
|
+
| "自 XXXX 年 XX 月 XX 日起施行" | 自 2025-01-22 起施行 |
|
|
36
|
+
| "自印发之日起施行" | 重庆市创新医疗器械管理办法 |
|
|
37
|
+
| "自 XXXX 年 XX 月 XX 日起执行,有效期 X 年" | 深圳宝安区措施:3 年 |
|
|
38
|
+
|
|
39
|
+
**Extraction:** grep for `自.*起施行|自.*起执行|有效期.*年`
|
|
40
|
+
|
|
41
|
+
### 4. Filing / Application Deadline (申报截止)
|
|
42
|
+
|
|
43
|
+
For competitive programs, funding applications, and pilot project solicitations:
|
|
44
|
+
|
|
45
|
+
| Source | Deadline |
|
|
46
|
+
|--------|----------|
|
|
47
|
+
| "请于 XXXX 年 XX 月 XX 日前报送" | 海珠区 AI 场景:2026-04-18 |
|
|
48
|
+
| "于 XXXX 年 XX 月 XX 日前将申报材料报送" | 养老机器人试点:2025-07-10 |
|
|
49
|
+
|
|
50
|
+
**Extraction:** grep for `于.*前|截止.*时间|报送.*日期`
|
|
51
|
+
|
|
52
|
+
### 5. Subsidy / Funding Expiration (补贴截止)
|
|
53
|
+
|
|
54
|
+
Each subsidy program has its own end date, often in the supporting table rather than the policy body:
|
|
55
|
+
|
|
56
|
+
| Expression | Meaning |
|
|
57
|
+
|------------|---------|
|
|
58
|
+
| "政策实施期限暂定 2026 年" | Tentative, subject to extension |
|
|
59
|
+
| "政策实施截至 2027 年 12 月 31 日" | Hard deadline |
|
|
60
|
+
| "试行 1 年" | 1-year trial from issuance date |
|
|
61
|
+
| "至 2028-05" | Month-level precision |
|
|
62
|
+
| "至 2028 年 12 月 31 日结束" | Year-end hard stop |
|
|
63
|
+
|
|
64
|
+
**Extraction:** grep for `期限|截止|结束|试行.*年|有效期` in subsidy/funding sections.
|
|
65
|
+
|
|
66
|
+
### 6. Project Execution Period (项目实施周期)
|
|
67
|
+
|
|
68
|
+
For programs that fund specific projects, the allowable execution window:
|
|
69
|
+
|
|
70
|
+
| Provision | Example |
|
|
71
|
+
|-----------|---------|
|
|
72
|
+
| "实施周期原则上不超过 X 年" | 重庆市创新医疗器械:≤ 3 年 |
|
|
73
|
+
| "可延长,最长 1 年" | With extension mechanism |
|
|
74
|
+
| "每个项目只能申请 1 次时间延长" | One-time extension limit |
|
|
75
|
+
|
|
76
|
+
### 7. Document Issuance Date (发文日期)
|
|
77
|
+
|
|
78
|
+
The official publish date from the document footer. Useful for recency assessment:
|
|
79
|
+
|
|
80
|
+
| Source | Example |
|
|
81
|
+
|--------|---------|
|
|
82
|
+
| Government document footer | 2025 年 2 月 24 日 |
|
|
83
|
+
| Official letter number | 粤府办〔2025〕4号(year embedded in 文号) |
|
|
84
|
+
|
|
85
|
+
## Practical Workflow
|
|
86
|
+
|
|
87
|
+
### Step 1 — Scan all documents for time patterns
|
|
88
|
+
|
|
89
|
+
Use a broad grep across all converted markdown files:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
cd tasks/<task-name>/docs
|
|
93
|
+
grep -n -E '(有效期|截止|自.*起|至.*止|期限|到.*年|试行|实施.*年|年度)' *.md | grep -v '来源文件'
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Step 2 — Categorize into the 7 types above
|
|
97
|
+
|
|
98
|
+
Group results by category. Some entries may fit multiple categories — pick the primary one.
|
|
99
|
+
|
|
100
|
+
### Step 3 — Annotate the merged document
|
|
101
|
+
|
|
102
|
+
For each policy heading in the merged document, add a blockquote line:
|
|
103
|
+
|
|
104
|
+
```markdown
|
|
105
|
+
### Policy Name
|
|
106
|
+
|
|
107
|
+
> **发文:** 2025-02-24 | **文号:** 粤府办〔2025〕4号 | **目标节点:** 2027 年
|
|
108
|
+
> **施行:** 2025-05-18 | **有效期:** 3 年(至 2028-05-18)
|
|
109
|
+
> **申报截止:** 2026-04-18
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Use pipe-separated format within a single `>` line for compactness. Multiple lines only when a policy has many time attributes.
|
|
113
|
+
|
|
114
|
+
### Step 4 — Add a summary table to summary.md
|
|
115
|
+
|
|
116
|
+
In the summary document, add a comprehensive time table:
|
|
117
|
+
|
|
118
|
+
```markdown
|
|
119
|
+
## 政策有效期与关键时间节点
|
|
120
|
+
|
|
121
|
+
### 目标完成期限
|
|
122
|
+
| 政策 | 节点目标 | 期限 |
|
|
123
|
+
|------|---------|------|
|
|
124
|
+
| ... | ... | 2027年 |
|
|
125
|
+
|
|
126
|
+
### 申报截止日期
|
|
127
|
+
| 项目 | 截止时间 |
|
|
128
|
+
|------|---------|
|
|
129
|
+
| ... | 2026-04-18 |
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## Pitfalls
|
|
133
|
+
|
|
134
|
+
- **文号中的年份** — 渝府办发〔2025〕57号 tells you the year is 2025, but the actual validity may extend to 2027. The 文号 year is the issuance year, not the policy period.
|
|
135
|
+
- **"试行" ≠ short-term** — 试行 policies often remain in effect indefinitely until formally replaced. The trial label means the policy is provisional, not that it has a hard expiration.
|
|
136
|
+
- **Deadlines in attachments** — critical deadlines (especially for subsidies) are often in XLSX spreadsheets or appendix tables, not the main policy body. Always scan supplementary files.
|
|
137
|
+
- **Cross-referencing other policies** — some policies say "有效期至 XXXX 年" but the referenced implementation rules may have a different timeline. Document both.
|