This skill organizes scattered speech transcription project files into clearly structured Markdown documents for archiving in knowledge bases such as Obsidian.
It adopts the "Agent planning + script execution" model:
- Agent (you): responsible for understanding the directory structure, identifying file types, logically sorting segmented files (for example, by line numbers 1-200, 201-400), and generating a merge plan.
- Script: responsible for mechanically reading files and generating Markdown according to your plan.
Use Cases
Use this when the user asks to "organize and archive" a directory containing multiple raw audio files, dozens of transcription segments, and various explanatory documents.
Workflow
1. Survey & Analyze
First, use list_directory (together with globif necessary) to scan the target project directory.
You need to answer the following questions:
- Which are theraw recording texts? (usually in
1-原始文件or a similar directory) - Which are thefinal output segmented scripts? (usually in
5-最终输出, with file names containing line numbers such as_1-200)- Key task: you need to sort them correctly according to the numbers in the file names.
- Which areproject metadata? (logs, glossaries, background requirements, etc.)
- Which arederived knowledge/Q&A?(
5-最终输出non-segmented Markdown files)
2. Generate Configuration
Based on your analysis, build a JSON configuration file. Do not output it directly to the user; instead, prepare to write it to a temporary file.
JSON structure definition:
{
"output_dir": "目标项目路径/obsidian_archive",
"tasks": [
{
"filename": "1-原始录音汇总.md",
"title": "原始录音汇总",
"sections": [
{
"title": "文件1.txt",
"path": "绝对路径或相对路径/文件1.txt",
"syntax": "text"
}
]
},
{
"filename": "2-最终输出脚本汇总.md",
"title": "最终输出脚本汇总",
"sections": [
{
"title": "Part 1 (1-200)",
"path": "路径/output_1-200.txt",
"syntax": "text"
},
{
"title": "Part 2 (201-400)",
"path": "路径/output_201-400.txt",
"syntax": "text"
}
// Agent 必须确保这里的顺序是正确的!
]
}
// ... 继续为“整理要求汇总”和“知识整理汇总”创建任务
]
}
3. Execute
-
Use
write_fileto save the JSON configuration as a temporary file, for examplemerge_plan.json。 -
Call the script to execute the merge:
python3 .gemini/skills/long-audio-to-obsidian/scripts/doc_merger.py merge_plan.json(Note: please adjust the script path according to the actual installation location)
-
Check the script output to confirm successful generation.
-
Delete the temporary file
merge_plan.json。
4. Rename & Index
The script only generates intermediate products with standard file names. To make them convenient for Obsidian, you need to perform one final step of artificial intelligence optimization:
- Determine the project title: based on the original directory name or core file name, extract a clear project title (for example
2024-01-01 会议转写 - 项目 A)。 - Rename files: use
run_shell_command'smvcommand to rename the standard files inobsidian_archiveto a prefixed format.1-原始录音汇总.md->{标题} 1 原始录音汇总.md2-最终输出脚本汇总.md->{标题} 2 最终输出脚本汇总.md- ...and so on.
- Generate an index page:
- Create a new file named
{标题}.md. - The content should include Obsidian WikiLinks (
[[文件名]])。 - If there are related external product documents (not merged in), links can also be added here.
- Create a new file named
Example index page content:
相关文档:
[[2024-01-01 会议转写 - 项目 A 1 原始录音汇总]]
[[2024-01-01 会议转写 - 项目 A 2 最终输出脚本汇总]]
...
Archiving Standards
Please organize the output files according to the following four dimensions (corresponding to the 4 tasks in the JSON):
- Raw Recording Summary: Contains all raw recording texts.
- Final Output Script Summary: Contains all proofread and merged segmented texts.Order is critical。
- Organization Requirements and Log Summary:
- Work Log (
0-工作日志.md) - Proofreading Glossary (
3-校对和术语表.md) - Segment Topics (
4-分段主题.md) - All Background Requirement Files (
2-要求和信息/*)
- Work Log (
- Knowledge Organization Summary:
- Contains all derived generated knowledge files (such as
问题和回答-xxx.md)。
- Contains all derived generated knowledge files (such as
Notes
- Path Handling: The
pathin JSON is recommended to use absolute paths, or relative paths relative to whendoc_merger.pyis executed. - Fault Tolerance: If an expected directory does not exist (for example, there is no "Knowledge Organization" file), then do not include the corresponding task in the JSON, or create an empty task.
- Sorting: The script will not sort automatically.MustAll logical sorting of files must be completed by the Agent when generating the JSON.