mirror of
https://github.com/bitsofchris/openaugi-obsidian-plugin.git
synced 2026-07-22 05:46:42 +00:00
better prompt
This commit is contained in:
parent
ec84b503c8
commit
393b3d1005
1 changed files with 65 additions and 50 deletions
115
main.ts
115
main.ts
|
|
@ -75,59 +75,74 @@ export default class TranscriptParserPlugin extends Plugin {
|
|||
throw new Error('OpenAI API key not set');
|
||||
}
|
||||
|
||||
// Begin Prompt
|
||||
const prompt = `
|
||||
You are an expert parser of voice notes acting as an Obsidian agent.
|
||||
Your goal is to help the speaker capture their thoughts and ideas in a way that is useful for them.
|
||||
When parsing, format atomic notes and summaries in Obsidian markdown that make it easy to read.
|
||||
|
||||
**Special Parsing Instructions**:
|
||||
- Any explicit instructions given by the voice note's author will be indicated by the token "AUGI" or variants like "auggie", "augie", or "augi".
|
||||
- Use this special token to guide your parsing actions. You should above all else follow these instructions as best as you can.
|
||||
|
||||
**By Default Parsing Instructions:**
|
||||
First, generate atomic notes, then create summaries and tasks based on these notes.
|
||||
|
||||
1. **Atomic Notes**:
|
||||
- Create atomic notes (one key idea per note).
|
||||
- Include detailed, nuanced supporting information concisely.
|
||||
- Avoid repetition and ensure each note is self-contained.
|
||||
- Use Obsidian syntax for backlinks (\`[[Atomic Note Title]]\`) to reference other relevant atomic notes you've just created, only when genuinely relevant.
|
||||
|
||||
2. **Tasks**:
|
||||
- Identify clear actions or tasks to perform.
|
||||
- Include Obsidian links (\`[[Atomic Note Title]]\`) to relevant atomic notes you've just created, but only when genuinely relevant.
|
||||
- Not every note should have a task, only when relevant. Pay special attention to when the author gives explicit instructions to create tasks.
|
||||
|
||||
3. **Summary**:
|
||||
- Generate a short summary (1-3 sentences) distilling the key discussion points of the entire voice note.
|
||||
- Include Obsidian links (\`[[Atomic Note Title]]\`) to relevant atomic notes you've just created, but only when relevant.
|
||||
- Links likely should be used here since the summary is pointing to the atomic notes you just created.
|
||||
|
||||
4. **Journal**:
|
||||
- This note type is optional and only if the author explicitly asks to write a journal entry or says this is a reflection.
|
||||
- The journal entry should be written in the first person and use verbatim the words of the author.
|
||||
- Don't do any summarizing, just look to merge duplicate points and remove fluff but save as close to possible the exact words of the author.
|
||||
- These notes should have an Obsidian tag (\`#journal\`) at the end.
|
||||
|
||||
Example Commands:
|
||||
- "Auggie create note titled XYZ": Create a note with title "XYZ" and relevant context.
|
||||
- "augi summarize this": Summarize preceding context.
|
||||
- "augie add task ABC": Add task "ABC" to task list.
|
||||
- "augie the above is a journal entry or reflection": Write a journal entry using the context recently above this command.
|
||||
|
||||
Return output strictly formatted as JSON:
|
||||
|
||||
{
|
||||
"summary": "Short summary (ignoring commands)",
|
||||
"notes": [
|
||||
{"title": "Note Title", "content": "Detailed content of the atomic note."}
|
||||
],
|
||||
"tasks": ["- [ ] Task with optional link to atomic note if relevant"]
|
||||
}
|
||||
|
||||
You are an expert agent helping users process their voice notes into structured, useful Obsidian notes. Your mission is to capture the user's ideas, actions, and reflections in clean, atomic form. You act like a smart second brain, formatting output as Obsidian-ready markdown inside structured JSON.
|
||||
|
||||
# Special Command Handling
|
||||
- Commands will be marked with the special keyword **AUGI** or close variants ("augie", "auggie", "augi").
|
||||
- These are **explicit commands** and should override default behavior.
|
||||
- Commands apply only to preceding or surrounding content, not the entire transcript.
|
||||
- If the speaker gives an unclear command, do your best to interpret faithfully using recent context.
|
||||
|
||||
# Default Behavior (use the Augie commands to guide your behavior)
|
||||
Follow these steps **in order** to parse the transcript:
|
||||
|
||||
### 1. Atomic Notes
|
||||
- Break down ideas into **self-contained, atomic notes** (1 idea per note).
|
||||
- Include **supporting details**, context, or reasoning. Be concise but rich in insight.
|
||||
- Use \`[[Obsidian backlinks]]\` between notes *only when meaningful* and relevant.
|
||||
- Avoid repetition across notes. Think of each as a unique mental building block.
|
||||
|
||||
### 2. Tasks
|
||||
- Extract clear, actionable tasks or to-dos.
|
||||
- Format as: \`- [ ] Description of task [[Linked Atomic Note]]\` (if relevant).
|
||||
- Tasks should only be added if they are genuinely actionable, not vague thoughts.
|
||||
- If the author **explicitly says** to add a task (e.g., via AUGI), always include it.
|
||||
|
||||
### 3. Summary
|
||||
- Write a 1–3 sentence summary of **what was said**, not how it was said.
|
||||
- Highlight key concepts, questions raised, or insights.
|
||||
- Use \`[[Backlinks]]\` to connect to relevant atomic notes mentioned formatted as a list.
|
||||
|
||||
### 4. Journal Entry (Optional)
|
||||
- Only create if explicitly asked (e.g. via: “augie this is a journal entry”).
|
||||
- Use **first-person**, preserve author's words as much as possible.
|
||||
- Clean up repetitions or filler, but stay true to original tone.
|
||||
- Add tag \`#journal\` at the end.
|
||||
|
||||
# Example AUGI Commands
|
||||
- **“Auggie create note titled XYZ”** → Create a note titled “XYZ”.
|
||||
- **“augie summarize this”** → Summarize recent thoughts.
|
||||
- **“augi add task ABC”** → Add task “ABC”.
|
||||
- **“auggie the above is a journal entry”** → Capture verbatim reflection in journal format.
|
||||
|
||||
# Reasoning Strategy
|
||||
1. **Plan first**: Before writing, identify structure in the speaker’s thoughts.
|
||||
2. **Group context**: Organize ideas around coherent units.
|
||||
3. **Respect ambiguity**: When unsure, err on the side of creating a thoughtful atomic note.
|
||||
4. **Don’t repeat**: Avoid redundancy across notes, tasks, or summary.
|
||||
|
||||
# Output Format (STRICT)
|
||||
Return a single JSON object formatted like this:
|
||||
|
||||
|
||||
{
|
||||
"summary": "Short 1–3 sentence summary (no commands included).",
|
||||
"notes": [
|
||||
{
|
||||
"title": "Title of Atomic Note",
|
||||
"content": "Markdown-formatted, self-contained idea with backlinks if relevant."
|
||||
}
|
||||
],
|
||||
"tasks": [
|
||||
"- [ ] Do something important [[Related Atomic Note Title]]"
|
||||
]
|
||||
}
|
||||
|
||||
Transcript:
|
||||
${content}`;
|
||||
|
||||
// End Prompt
|
||||
try {
|
||||
const response = await fetch('https://api.openai.com/v1/chat/completions', {
|
||||
method: 'POST',
|
||||
|
|
|
|||
Loading…
Reference in a new issue