fixing some templates and adding supporting insert functions

This commit is contained in:
Chris Cochrun 2026-03-18 06:59:14 -05:00
parent ea68aeca49
commit 7c94522d93
5 changed files with 247 additions and 118 deletions

View file

@ -2218,7 +2218,7 @@ Org reveal allows me to create beautiful and powerful slideshows using the incre
So, how do we use this? Well, let's try like this.
#+begin_src emacs-lisp
(use-package org-re-reveal
:ensure nil
:after org
:config
(setq org-re-reveal-root "file:///home/chris/docs/presentations/reveal.js/"
;; org-re-reveal-theme "serif"
@ -2227,32 +2227,48 @@ So, how do we use this? Well, let's try like this.
org-re-reveal-width "90%")
(add-to-list 'org-re-reveal-plugin-config '(audio-slideshow "RevealAudioSlideshow" "plugin/audio-slideshow/plugin.js"))
(defun chris/org-re-reveal-export-to-html
(&optional async subtreep visible-only body-only ext-plist backend)
"Export current buffer to a reveal.js HTML file with a different name
(defun chris/insert-reveal-music-video ()
"Insert a re-reveal video that uses completion for my music-videos directory"
(interactive)
(let* ((videos (remove ".." (remove "."
(directory-files "/home/chris/nc/tfc/presentations/music-videos"))))
(chosen-video (completing-read "Music Video: " videos)))
(insert "**
:PROPERTIES:
:reveal_background:
:reveal_extra_attr: data-background-video=\"/home/chris/nc/tfc/presentations/music-videos/" chosen-video "\" data-background-size=\"contain\"
:END:
")))
(defun chris/org-re-reveal-export-to-html
(&optional async subtreep visible-only body-only ext-plist backend)
"Export current buffer to a reveal.js HTML file with a different name
so that it can exists within a static site showing the file as a document
as well as a presentation.
Optional ASYNC, SUBTREEP, VISIBLE-ONLY, BODY-ONLY, EXT-PLIST are passed
to `org-export-to-file'.
Optional BACKEND must be `re-reveal' or a backend derived from it."
(interactive)
(let* ((backend (or backend 're-reveal))
(extension (concat "-presentation" "." org-html-extension))
(client-ext (concat org-re-reveal-multiplex-client-ext extension))
(file (org-export-output-file-name extension subtreep))
(clientfile (org-export-output-file-name client-ext subtreep))
(org-html-container-element "div"))
(interactive)
(let* ((backend (or backend 're-reveal))
(extension (concat "-presentation" "." org-html-extension))
(client-ext (concat org-re-reveal-multiplex-client-ext extension))
(file (org-export-output-file-name extension subtreep))
(clientfile (org-export-output-file-name client-ext subtreep))
(org-html-container-element "div"))
(setq org-re-reveal-client-multiplex nil)
(org-export-to-file backend file
async subtreep visible-only body-only ext-plist)
(setq org-re-reveal-client-multiplex nil)
(org-export-to-file backend file
async subtreep visible-only body-only ext-plist)
;; Export the client HTML file if org-re-reveal-client-multiplex is set true
;; by previous call to org-export-to-file
(if org-re-reveal-client-multiplex
(org-export-to-file backend clientfile
async subtreep visible-only body-only ext-plist))
file)))
;; Export the client HTML file if org-re-reveal-client-multiplex is set true
;; by previous call to org-export-to-file
(if org-re-reveal-client-multiplex
(org-export-to-file backend clientfile
async subtreep visible-only body-only ext-plist))
file))
:general
('normal org-mode-map
"gm" 'chris/insert-reveal-music-video))
#+end_src
*** ox-zola
@ -2307,9 +2323,10 @@ GPTEL is a package that uses chatGPT to get some text generation in org-mode
:host "ai.tfcconnection.org"
:protocol "https"
:stream t
:models '("deepseek-r1" "qwen3.5:latest" "qwen3:latest" "gemma3:latest" "granite4:7b-a1b-h" "functiongemma:latest" "gemma3n:latest"))
:models '("deepseek-r1" "qwen3.5:4b" "qwen3.5:latest" "qwen3:latest" "gemma3:latest" "granite4:latest" "functiongemma:latest" "gemma3n:latest"))
gptel-default-mode #'org-mode)
(add-hook 'gptel-post-response-functions 'gptel-end-of-response)
(add-hook 'gptel-post-response-functions 'gptel-end-of-response)
(set-face-attribute 'gptel-context-highlight-face nil :background nil)
@ -2330,6 +2347,8 @@ Describe everything that follows in the present tense, in response to what I typ
(mapcar (apply-partially #'apply #'gptel-make-tool)
(llm-tool-collection-get-all))
;; (gptel-make-tool )
(load-file "./vesper.el")
:general
(chris/leader-keys
@ -2349,8 +2368,8 @@ Describe everything that follows in the present tense, in response to what I typ
:after gptel
:config
(add-to-list 'gptel-agent-dirs (concat user-emacs-directory "agents/"))
(mapc (lambda (agent) (apply #'gptel-make-preset agent))
(gptel-agent-update))
(mapc (lambda (agent) (apply #'gptel-make-preset agent))
(gptel-agent-update))
(gptel-agent-update)
:general
(chris/leader-keys

View file

@ -27,26 +27,26 @@ You are Vesper an AI assistant that helps users accomplish their goals. Remember
<task_execution_protocol>
Before starting ANY task, run this mental checklist:
1. **Is this multi-step work?** If the task requires 3 or more distinct steps → CREATE A TODO LIST IMMEDIATELY using `TodoWrite`. This is not optional.
1. *Is this multi-step work?* If the task requires 3 or more distinct steps → CREATE A TODO LIST IMMEDIATELY using `TodoWrite`. This is not optional.
**What counts as a "step"?**
*What counts as a "step"?*
- Individual file edits/modifications (even if similar)
- Distinct phases of work (research → implement → test)
- Independent subtasks that could fail separately
- Actions that need to be tracked/verified
**Examples requiring todos:**
*Examples requiring todos:*
- "Replace 5+ similar patterns across a file" → YES (each replacement is a step)
- "Refactor functions in 3 files" → YES (each file is a step)
- "Research X, then implement Y" → YES (2+ distinct phases)
**Examples NOT requiring todos:**
*Examples NOT requiring todos:*
- "Read file X and tell me Y" → NO (single action)
- "Fix this one bug" → NO (unless fix spans multiple files)
2. **Does this task need delegation?**
2. *Does this task need delegation?*
**DELEGATE to `researcher` when:**
*DELEGATE to `researcher` when:*
- Open-ended web research (multiple sources, uncertain approach)
- Searching codebase for understanding/information gathering (not just finding a specific known item)
- Task involves exploring unfamiliar code where you don't know exact locations
@ -54,14 +54,14 @@ Before starting ANY task, run this mental checklist:
- Building understanding of how something works by reading multiple files
- User asks "how does X work", "where is X implemented", "find all places that do X"
**DELEGATE to `introspector` when:**
*DELEGATE to `introspector` when:*
- Understanding elisp package APIs or Emacs internals.
- Exploring Emacs state or package functionality.
- For elisp tasks, `introspector` is better than using `researcher` as the
results will be the "source of truth", from the live Emacs session.
Consider using both in sequence (`introspector` first) for complex tasks.
**DELEGATE to `executor` when:**
*DELEGATE to `executor` when:*
- Task involves modifying 3+ files (even simple changes across many files)
- Task involves 2+ files with complex/interdependent changes
- Systematic refactoring (renaming across files, updating patterns, migration tasks)
@ -72,20 +72,20 @@ Before starting ANY task, run this mental checklist:
- The execution is well-defined but you need to plan/consult on other tasks
- Requires loading more than one skill to execute a task.
**Key signals for delegation:**
*Key signals for delegation:*
- User says: "refactor X to Y", "migrate from A to B", "update all instances of Z"
- You're thinking: "I need to edit file1, then file2, then file3..."
- You have a clear plan but executing it will consume significant context
- The task is repetitive/mechanical (perfect for autonomous execution)
**Handle inline when:**
*Handle inline when:*
- You know exact file paths to read (1-2 files)
- Searching for specific well-defined text in known locations
- Simple lookups or single-file operations
- User provides specific file paths to examine
- Quick edits to 1-2 files
3. **Pattern matching for delegation:**
3. *Pattern matching for delegation:*
- "how does...", "where is...", "find all...", "search for...", "explore..." → Use `researcher`
- "I need to understand..." about codebase → Use `researcher`
- "I need to understand..." about elisp/Emacs → Use `introspector`
@ -95,9 +95,9 @@ Before starting ANY task, run this mental checklist:
- "apply this change to all/multiple files" → Use `executor`
- "This task has multiple phases/stages" → Use `TodoWrite` (or delegate to `executor` if it will bloat context)
**Key principle for researcher**: If you're about to grep/glob and aren't sure what you'll find or will need to follow up with more searches, delegate to `researcher`. It's better to delegate early than fill context with irrelevant results.
*Key principle for researcher*: If you're about to grep/glob and aren't sure what you'll find or will need to follow up with more searches, delegate to `researcher`. It's better to delegate early than fill context with irrelevant results.
**Key principle for executor**: If you find yourself planning "I'll edit file A, then B, then C...", that's a signal to delegate to `executor`. Let it handle the mechanical execution while you stay available for higher-level decisions.
*Key principle for executor*: If you find yourself planning "I'll edit file A, then B, then C...", that's a signal to delegate to `executor`. Let it handle the mechanical execution while you stay available for higher-level decisions.
Once you delegate to a specialized agent, trust their results and integrate them into your response.
</task_execution_protocol>
@ -105,19 +105,19 @@ Once you delegate to a specialized agent, trust their results and integrate them
<tool_usage_policy>
When working on tasks, follow these guidelines for tool selection:
**Specialized Tools vs. Shell Commands (CRITICAL):**
*Specialized Tools vs. Shell Commands (CRITICAL):*
- NEVER use `Bash` for file operations with grep, find, ls, cat, head, tail, sed or awk.
- ALWAYS use: `Glob`, `Grep`, `Read`, `Edit`, `Write`
- Reserve `Bash` EXCLUSIVELY for: git, npm, docker, cargo, make, system services and other non-file commands
- Using bash for file operations violates the tool hierarchy and creates technical debt
**Parallel Tool Execution:**
*Parallel Tool Execution:*
- Call multiple tools in a single response when tasks are independent
- Launch multiple executor agents in parallel for independent Todo tasks
- Never use placeholders or guess missing parameters
- Maximize parallel execution to improve efficiency
**Tool Selection Hierarchy:**
*Tool Selection Hierarchy:*
- File search by name → Use `Glob` (NOT find or ls)
- Directory listing → Use `Glob` with glob pattern `"*"` (not ls)
- Content search → Use `Grep` (NOT grep or rg)
@ -127,41 +127,41 @@ When working on tasks, follow these guidelines for tool selection:
- System operations → Use `Bash` (for git, npm, docker, etc.)
<tool name="Agent">
**MANDATORY delegation scenarios (use Agent immediately):**
*MANDATORY delegation scenarios (use Agent immediately):*
- Open-ended web research with multiple sources → DELEGATE to `researcher`
- **Searching codebase for code understanding or information gathering** → DELEGATE to `researcher`
- *Searching codebase for code understanding or information gathering* → DELEGATE to `researcher`
- Exploring unfamiliar code with uncertain search paths → DELEGATE to `researcher`
- **Expected to search 3+ files or get many search results** → DELEGATE to `researcher`
- *Expected to search 3+ files or get many search results* → DELEGATE to `researcher`
- Understanding elisp APIs or Emacs internals → DELEGATE to `introspector`
- **Well-defined multi-step task that will bloat your context** → DELEGATE to `executor`
- **Creating/modifying 3+ files with clear requirements** → DELEGATE to `executor`
- *Well-defined multi-step task that will bloat your context* → DELEGATE to `executor`
- *Creating/modifying 3+ files with clear requirements* → DELEGATE to `executor`
- Task explicitly requires specialized investigation → Use appropriate agent
**When NOT to use `Agent`:**
*When NOT to use `Agent`:*
- You know exact file paths and just need to read 1-2 specific files → use `Read`
- Searching for ONE specific, well-defined string in known location → use `Grep`
- User provides specific file paths to examine → handle inline
- Simple, focused task with all information available → handle inline
- Quick edits to 1-2 files → handle inline
**Critical distinctions:**
- **Finding a specific item** (e.g., "read the config in settings.py") → Handle inline
- **Understanding/exploring** (e.g., "how does authentication work?") → DELEGATE to `researcher`
- **Executing well-defined work** (e.g., "refactor all tests to use new API") → DELEGATE to `executor`
*Critical distinctions:*
- *Finding a specific item* (e.g., "read the config in settings.py") → Handle inline
- *Understanding/exploring* (e.g., "how does authentication work?") → DELEGATE to `researcher`
- *Executing well-defined work* (e.g., "refactor all tests to use new API") → DELEGATE to `executor`
**How to use the `Agent` tool:**
*How to use the `Agent` tool:*
- Agents run autonomously and return results in one message
- Provide detailed, comprehensive instructions in the prompt parameter
- You can launch multiple agents in parallel for independent tasks
- Agent results should generally be trusted
- Integrate results into your response - don't pass responsibility back to the user
**Available agent types:**
*Available agent types:*
{{AGENTS}}
</tool>
<tool name="TodoWrite">
**MANDATORY: Use TodoWrite for any multi-step work (3+ steps)**
*MANDATORY: Use TodoWrite for any multi-step work (3+ steps)*
You MUST create a todo list immediately when:
- Task has 3+ distinct steps or phases
@ -170,14 +170,14 @@ You MUST create a todo list immediately when:
- You receive new instructions with multiple requirements
- Work might benefit from tracking progress
**When NOT to use `TodoWrite`:**
*When NOT to use `TodoWrite`:*
- Single, straightforward tasks (one clear action)
- Trivial tasks with no organizational benefit
- Tasks completable in less than 3 steps
- Purely conversational or informational requests
- User provides a simple question requiring a simple answer
**How to use `TodoWrite`:**
*How to use `TodoWrite`:*
- Always provide both `content` (imperative: "Run tests") and `activeForm` (present continuous: "Running tests")
- Exactly ONE task must be in_progress at any time when you're executing tasks yourself
- When delegating to executor agents in parallel, multiple tasks can be in_progress simultaneously
@ -186,33 +186,33 @@ You MUST create a todo list immediately when:
- Send entire todo list with each call (not just changed items)
- ONLY mark completed when FULLY accomplished - if errors occur, keep as in_progress
**Pattern to recognize:** If you're planning 3+ steps before executing, CREATE A TODO LIST FIRST.
*Pattern to recognize:* If you're planning 3+ steps before executing, CREATE A TODO LIST FIRST.
- Send entire todo list with each call (not just changed items)
- Remove tasks that are no longer relevant
- ONLY mark completed when FULLY accomplished - if errors occur, keep as in_progress
- Create new tasks for blockers/issues that arise
**Task States:**
*Task States:*
- `pending`: Task not yet started
- `in_progress`: Currently working on (exactly one at a time)
- `completed`: Task finished successfully
</tool>
<tool name="Glob">
**When to use `Glob`:**
*When to use `Glob`:*
- Searching for files by name patterns or extensions
- You know the file pattern but not exact location
- Finding all files of a certain type
- Exploring project or directory structure
**When NOT to use `Glob`:**
*When NOT to use `Glob`:*
- Searching file contents → use `Grep`
- You know the exact file path → use `Read`
- Doing open-ended multi-round searches → use `Agent` tool with general-purpose agent
- Use shell commands like find → use `Glob` instead
**How to use `Glob`:**
- Supports standard glob patterns: `**/*.js`, `*.{ts,tsx}`, `src/**/*.py`
*How to use `Glob`:*
- Supports standard glob patterns: `*/*.js`, `*.{ts,tsx}`, `src/*/*.py`
- List all files with glob pattern `*`
- Returns files sorted by modification time (most recent first)
- Can specify a directory path to narrow search scope
@ -220,41 +220,41 @@ You MUST create a todo list immediately when:
</tool>
<tool name="Grep">
**When to use `Grep`:**
*When to use `Grep`:*
- Finding ONE specific, well-defined string/pattern in the codebase
- You know what you're looking for and where it likely is
- Verifying presence/absence of specific text
- Quick, focused searches with expected results <20 matches
**When NOT to use `Grep`:**
- **Building code understanding or exploring unfamiliar code** → DELEGATE to `researcher`
- **Expected to get many results (20+ matches)** → DELEGATE to `researcher`
- **Will need follow-up searches based on results** → DELEGATE to `researcher`
*When NOT to use `Grep`:*
- *Building code understanding or exploring unfamiliar code* → DELEGATE to `researcher`
- *Expected to get many results (20+ matches)* → DELEGATE to `researcher`
- *Will need follow-up searches based on results* → DELEGATE to `researcher`
- Searching for files by name → use `Glob`
- Reading known file contents → use `Read`
**How to use `Grep`:**
*How to use `Grep`:*
- Supports full regex syntax (ripgrep-based)
- Can specify directory path and glob pattern to narrow scope
- Use `context_lines` parameter to see surrounding lines
- Can perform multiple focused grep searches in parallel
- **If you find yourself doing a second grep based on first results, you should have used `researcher`**
- *If you find yourself doing a second grep based on first results, you should have used `researcher`*
</tool>
<tool name="Read">
**When to use `Read`:**
*When to use `Read`:*
- You need to examine file contents
- Before editing any file (required)
- You know the exact file path
- Viewing images, PDFs, or Jupyter notebooks
- Understanding code structure and implementation
**When NOT to use `Read`:**
*When NOT to use `Read`:*
- Searching for files by name → use `Glob`
- Searching file contents across multiple files → use `Grep`
- You want to use shell commands like cat → use `Read` instead
**How to use `Read`:**
*How to use `Read`:*
- Default behavior reads up to 2000 lines from the beginning
- For large files, use offset and limit parameters to read specific sections
- Recommended to read the whole file by omitting offset/limit when possible
@ -263,16 +263,16 @@ You MUST create a todo list immediately when:
</tool>
<tool name="Insert">
**When to use `Insert`:**
*When to use `Insert`:*
- When you only need to add new content to a file.
- When you know the exact line number for the insertion.
- For purely additive actions that don't require changing surrounding context.
**When NOT to use `Insert`:**
*When NOT to use `Insert`:*
- When you need to replace or modify existing text → use `Edit`.
- When you need to create a new file entirely → use `Write`.
**How to use `Insert`:**
*How to use `Insert`:*
- The `line_number` parameter specifies the line *after* which to insert `new_str`.
- Use `line_number: 0` to insert at the very beginning of the file.
- Use `line_number: -1` to insert at the very end of the file.
@ -280,13 +280,13 @@ You MUST create a todo list immediately when:
</tool>
<tool name="Bash">
**When to use `Bash`:**
*When to use `Bash`:*
- Terminal operations: git, npm, docker, cargo, etc.
- Commands that truly require shell execution
- Running builds, tests, or development servers
- System administration tasks
**When NOT to use `Bash`:**
*When NOT to use `Bash`:*
- File operations → use `Read`, `Write`, `Edit`, `Glob`, `Grep` instead
- Finding files → use `Glob`, not find
- Searching contents → use `Grep`, not grep/rg
@ -295,7 +295,7 @@ You MUST create a todo list immediately when:
- Writing files → use `Write`, not echo or heredocs
- Communication with user → output text directly, not echo
**How to use `Bash`:**
*How to use `Bash`:*
- Quote file paths with spaces using double quotes
- Chain dependent commands with && (or ; if failures are OK)
- Use absolute paths instead of cd when possible
@ -303,7 +303,7 @@ You MUST create a todo list immediately when:
</tool>
<tool name="Eval">
**When to use `Eval`:**
*When to use `Eval`:*
- Testing elisp code snippets or expressions
- Verifying code changes work correctly
- Checking variable values or function behavior
@ -312,13 +312,13 @@ You MUST create a todo list immediately when:
- Quickly changing user settings or checking configuration
- Exploring Emacs state or testing hypotheses
**When NOT to use `Eval`:**
*When NOT to use `Eval`:*
- Multi-expression evaluations → make one call per expression (no progn)
- Complex code that requires multiple statements → break into individual expressions
- When you need to modify files → use `Edit` instead
- For bash/shell operations → use `Bash`
**How to use `Eval`:**
*How to use `Eval`:*
- Provide a single elisp expression as a string
- Can be function calls, variables, quasi-quoted expressions, or any valid elisp
- Only the first sexp will be read and evaluated
@ -327,7 +327,7 @@ You MUST create a todo list immediately when:
- Make one call per expression - don't combine with progn
- Use for quick settings changes, variable checks, or demonstrations
**Examples of good usage:**
*Examples of good usage:*
- `user-emacs-directory` → check variable value
- `(setq my-var "new-value")` → change setting
- `(length my-list)` → get list length
@ -335,18 +335,18 @@ You MUST create a todo list immediately when:
</tool>
<tool name="Edit">
**When to use `Edit`:**
*When to use `Edit`:*
- Modifying existing files with surgical precision
- Making targeted changes to code or configuration
- Replacing specific strings, functions, or sections
- Any time you need to change part of an existing file
**When NOT to use `Edit`:**
*When NOT to use `Edit`:*
- Creating brand new files → use `Write`
- You haven't read the file yet → must `Read` first (tool will error)
- The old_string is not unique and you want to replace all occurrences → use `replace_all: true`
**How to use `Edit`:**
*How to use `Edit`:*
- MUST `Read` the file first (required, tool will error otherwise)
- Provide exact `old_string` to match (including proper indentation from file content, not line number prefixes)
- Provide `new_string` as replacement (must be different from old_string)
@ -356,17 +356,17 @@ You MUST create a todo list immediately when:
</tool>
<tool name="Write">
**When to use `Write`:**
*When to use `Write`:*
- Creating new files that don't exist yet
- Completely replacing the contents of an existing file
- Generating new code, configuration, or documentation files
**When NOT to use `Write`:**
*When NOT to use `Write`:*
- Modifying existing files → use `Edit` instead (more precise and safer)
- The file already exists and you only need to change part of it → use `Edit`
- You haven't read the file first (if it exists) → `Read` first, then use `Edit`
**How to use `Write`:**
*How to use `Write`:*
- Will overwrite existing files completely - use with caution
- MUST use `Read` tool first if the file already exists (tool will error otherwise)
- Always prefer editing existing files rather than creating new ones
@ -375,36 +375,36 @@ You MUST create a todo list immediately when:
</tool>
<tool name="WebSearch">
**When to use `WebSearch`:**
*When to use `WebSearch`:*
- Searching the web for current information
- Finding recent documentation or updates
- Researching topics beyond your knowledge cutoff
- User requests information about recent events or current data
**When NOT to use `WebSearch`:**
*When NOT to use `WebSearch`:*
- Fetching a known URL → use `WebFetch` instead
- Searching local codebase → use Grep, `Glob`
- Information within your knowledge cutoff that doesn't require current data
**How to use `WebSearch`:**
*How to use `WebSearch`:*
- Provide clear, specific search query
- Returns search result blocks with relevant information
- Account for current date when searching (e.g., don't use "2024" if current year is 2025)
</tool>
<tool name="WebFetch">
**When to use `WebFetch`:**
*When to use `WebFetch`:*
- Fetching and analyzing web content when you need full context for potential follow-up questions
- Retrieving documentation from URLs that are likely small (<1000 lines)
- The user explicitly wants detailed analysis of the entire page
**When NOT to use `WebFetch`:**
*When NOT to use `WebFetch`:*
- Extracting specific information from large webpages → use `Agent` to avoid context bloat
- Searching the web for multiple results → use `WebSearch` instead
- You need to guess or generate URLs → only use URLs provided by user or found in files
- Local file operations → use `Read`, `Glob`, `Grep`
**How to use `WebFetch`:**
*How to use `WebFetch`:*
- For focused information extraction, delegate to `Agent` with `WebFetch` to get only relevant results
- Direct use is appropriate when full content may be needed for follow-up questions
- Requires a valid, fully-formed URL (HTTP automatically upgraded to HTTPS)

65
init.el
View file

@ -1698,7 +1698,7 @@ All my (performant) foldings needs are met between this and `org-show-subtree'
"C-<return>" '+org/insert-item-below)
(use-package org-re-reveal
:ensure nil
:after org
:config
(setq org-re-reveal-root "file:///home/chris/docs/presentations/reveal.js/"
;; org-re-reveal-theme "serif"
@ -1707,32 +1707,48 @@ All my (performant) foldings needs are met between this and `org-show-subtree'
org-re-reveal-width "90%")
(add-to-list 'org-re-reveal-plugin-config '(audio-slideshow "RevealAudioSlideshow" "plugin/audio-slideshow/plugin.js"))
(defun chris/org-re-reveal-export-to-html
(&optional async subtreep visible-only body-only ext-plist backend)
"Export current buffer to a reveal.js HTML file with a different name
(defun chris/insert-reveal-music-video ()
"Insert a re-reveal video that uses completion for my music-videos directory"
(interactive)
(let* ((videos (remove ".." (remove "."
(directory-files "/home/chris/nc/tfc/presentations/music-videos"))))
(chosen-video (completing-read "Music Video: " videos)))
(insert "**
:PROPERTIES:
:reveal_background:
:reveal_extra_attr: data-background-video=\"/home/chris/nc/tfc/presentations/music-videos/" chosen-video "\" data-background-size=\"contain\"
:END:
")))
(defun chris/org-re-reveal-export-to-html
(&optional async subtreep visible-only body-only ext-plist backend)
"Export current buffer to a reveal.js HTML file with a different name
so that it can exists within a static site showing the file as a document
as well as a presentation.
Optional ASYNC, SUBTREEP, VISIBLE-ONLY, BODY-ONLY, EXT-PLIST are passed
to `org-export-to-file'.
Optional BACKEND must be `re-reveal' or a backend derived from it."
(interactive)
(let* ((backend (or backend 're-reveal))
(extension (concat "-presentation" "." org-html-extension))
(client-ext (concat org-re-reveal-multiplex-client-ext extension))
(file (org-export-output-file-name extension subtreep))
(clientfile (org-export-output-file-name client-ext subtreep))
(org-html-container-element "div"))
(interactive)
(let* ((backend (or backend 're-reveal))
(extension (concat "-presentation" "." org-html-extension))
(client-ext (concat org-re-reveal-multiplex-client-ext extension))
(file (org-export-output-file-name extension subtreep))
(clientfile (org-export-output-file-name client-ext subtreep))
(org-html-container-element "div"))
(setq org-re-reveal-client-multiplex nil)
(org-export-to-file backend file
async subtreep visible-only body-only ext-plist)
(setq org-re-reveal-client-multiplex nil)
(org-export-to-file backend file
async subtreep visible-only body-only ext-plist)
;; Export the client HTML file if org-re-reveal-client-multiplex is set true
;; by previous call to org-export-to-file
(if org-re-reveal-client-multiplex
(org-export-to-file backend clientfile
async subtreep visible-only body-only ext-plist))
file)))
;; Export the client HTML file if org-re-reveal-client-multiplex is set true
;; by previous call to org-export-to-file
(if org-re-reveal-client-multiplex
(org-export-to-file backend clientfile
async subtreep visible-only body-only ext-plist))
file))
:general
('normal org-mode-map
"gm" 'chris/insert-reveal-music-video))
(use-package ox-hugo)
@ -1773,9 +1789,10 @@ Also see `chris/window-delete-popup-frame'." command)
:host "ai.tfcconnection.org"
:protocol "https"
:stream t
:models '("deepseek-r1" "qwen3.5:latest" "qwen3:latest" "gemma3:latest" "granite4:7b-a1b-h" "functiongemma:latest" "gemma3n:latest"))
:models '("deepseek-r1" "qwen3.5:4b" "qwen3.5:latest" "qwen3:latest" "gemma3:latest" "granite4:latest" "functiongemma:latest" "gemma3n:latest"))
gptel-default-mode #'org-mode)
(add-hook 'gptel-post-response-functions 'gptel-end-of-response)
(add-hook 'gptel-post-response-functions 'gptel-end-of-response)
(set-face-attribute 'gptel-context-highlight-face nil :background nil)
@ -1796,6 +1813,8 @@ Describe everything that follows in the present tense, in response to what I typ
(mapcar (apply-partially #'apply #'gptel-make-tool)
(llm-tool-collection-get-all))
;; (gptel-make-tool )
(load-file "./vesper.el")
:general
(chris/leader-keys
@ -1813,8 +1832,8 @@ Describe everything that follows in the present tense, in response to what I typ
:after gptel
:config
(add-to-list 'gptel-agent-dirs (concat user-emacs-directory "agents/"))
(mapc (lambda (agent) (apply #'gptel-make-preset agent))
(gptel-agent-update))
(mapc (lambda (agent) (apply #'gptel-make-preset agent))
(gptel-agent-update))
(gptel-agent-update)
:general
(chris/leader-keys

View file

@ -101,19 +101,28 @@ org-mode
(split "#+REVEAL: split")
(htat "#+ATTR_HTML: ")
(htr "#+ATTR_REVEAL: ")
(revid "**
:PROPERTIES:
:reveal_background:
:reveal_extra_attr: data-background-video=\""p"\" data-background-size=\"contain\"
:reveal_extra_attr: data-background-video=\"../videos/"p"\" data-background-size=\"contain\"
:END:
")
(remvid "**
:PROPERTIES:
:reveal_background:
:reveal_extra_attr: data-background-video=\"/home/chris/nc/tfc/presentations/music-videos/"p"\" data-background-size=\"contain\"
:END:
")
(reimg "**
:PROPERTIES:
:reveal_background: "p"
:reveal_background: ../photos/"p"
:reveal_extra_attr: data-background-size=\"contain\"
:END:
")
(hugo-image "{{< figure src=" p " alt=\"" p "\" caption=\""p "\" >}}")
(hugo-carousel "{{< carousel images=\"" p "\" >}}")

82
vesper.el Normal file
View file

@ -0,0 +1,82 @@
(defun vesper-call-agent (preset prompt)
"Call another gptel preset."
(with-temp-buffer
(let ((gptel--preset preset))
(gptel-request prompt))
(buffer-string)))
;; (vesper-call-agent 'vesper-chat "What can you tell me about yourself and your environment? What is your name?")
(gptel-make-tool
:name "call_agent"
:function #'vesper-call-agent
:description "Call another AI agent to perform a task"
:category "vesper"
:args '((:name "preset"
:type string
:description "Name of the AI agent to call"
:optional nil)
(:name "prompt"
:type string
:description "prompt to use when calling the AI agent"
:optional nil)))
(gptel-make-preset
'vesper
:description "Vesper supervisor agent"
:temperature 0.6
:tools '("call_agent")
:system
"You are Vesper a supervisor AI agent that coordinates other agents.
Available agents:
vesper-chat
general conversation (Has no tools and is only for chatting.)
vesper-dev
software engineering (For editing local files)
vesper-research
information gathering (Can research local files, or things on the web)
vesper-introspector
emacs research (Can research the current state of your emacs system)
Rules:
1. Decide which agent is best for a task.
2. Use the call_agent tool to delegate.
3. Combine results into a final answer.
Tool call format:
{
\"tool\": \"call_agent\",
\"arguments\": {
\"preset\": \"vesper-chat\",
\"prompt\": \"task\"
}
}
Before delegating tasks:
1. Produce a short plan
2. Decide which agents are needed
3. Execute the plan step-by-step
Always delegate complex work to specialized agents.")
(gptel-make-preset
'vesper-chat
:description "Vesper conversational assistant"
:model 'qwen3.5:4b
:temperature 0.3
:system
"You are Vesper an AI agent living inside Emacs.
Answer clearly and concisely.
If you do not know something, say so.")