Files
git.taskfile.build/prompt.md
T

5.8 KiB

title, author, state, date_completed, model, input_tokens, output_tokens
title author state date_completed model input_tokens output_tokens
Implement prompt log commands Janik von Rotz <login@janikvonrotz.ch> completed 2026-09-25 moonshotai/Kimi-K2.6 ~67000 ~280

Implement prompt log commands

Note: @Clanker refers to the "ai agent" (you) who is working on this prompt file.

@Clanker when working on this prompt file, make sure to:

  • Read context and task section first
  • Prepare a list of todos
  • Update the todo list while working on task

Context

@Clanker Read the AGENTS.md and README.md to get an understanding of the project.

Task

Read bin/create-prompt and bin/list-prompts. The commands help manage prompt instruction. I would like to introduce new commands and a new system to manage prompt files.

Instead of storing the prompts in the prompts folder I would like to store them on a separated branch called prompt-log.

Design decisions

  • Worktree lifecycle: every command assumes the prompt-log git worktree exists and creates it on demand (same logic as init-prompt-log) if it doesn't — don't require the user to run init-prompt-log first every time.
  • Clipboard copy: the clipboard-copy step in the current create-prompt is dropped entirely, not carried over.
  • repo-path argument: wherever [repo-path] appears below, it means "operate on a different git repository" (worktree, branch, and prompt.md resolved relative to that path) — applied consistently, not just where spelled out under create-prompt.
  • prompt.md.template: remove the ${PROMPT_ID} placeholder (no more numbering) and stop create-prompt from exporting PROMPT_ID.
  • Session token/model capture: out of scope for this task — model, input_tokens, output_tokens stay manually filled in.

Commands

init-prompt-log

Ensures the current folder has a .git folder. Creates the prompt-log branch as an orphan branch (no shared history with main) via the dedicated git worktree. Idempotent — safe to run again if the branch/worktree already exists.

create-prompt <title> [repo-path]

Instead of creating an entry in the prompts folder this command creates the prompt.md file (always overwriting any existing one). The file name no longer matters. If repo-path is given, operates against that repository instead of the current directory.

prompt-with-pi [path]

Runs the pi command and pipes the content of prompt.md as query. The harness follows the instructions and updates the prompt.md file.

By default it uses the prompt.md of the current directory. It can also take a path to a prompt file.

log-prompt [repo-path]

Reads the current commit hash (git rev-parse --short HEAD) of the project and the content of prompt.md. Creates a file named <commit-hash>-<title-with-dashes-and-lowercase>.md in the prompt-log worktree, storing the content. Commits it with message title feat: add prompt file and the filename in the message body. Pushes prompt-log to the remote, warning (not failing) if the push doesn't succeed.

list-prompts [repo-path]

Outputs a table with headers:

  • date: first-commit date of the file on prompt-log
  • title: frontmatter attribute title in file
  • state: frontmatter attribute state in file
  • commit: short hash of commit from filename

Rows are sorted by date.

edit-prompt [commit] [repo-path]

If commit is not given, shows an fzf dialog of all files in the prompt-log branch, listing the frontmatter title. Selecting a file opens it directly in $EDITOR within the tmp/prompt-log worktree. If commit is given, opens that target file directly in $EDITOR. After the editor closes, the change is committed with feat: update prompt file and pushed (warning on failure). The file is edited in place; prompt.md is not involved.

show-prompt [commit] [repo-path]

Similar to edit-prompt but outputs the prompt content directly to stdout instead of opening in $EDITOR. Accepts an optional commit prefix or shows an fzf dialog when no commit is given.

convert-prompts-folder-to-prompt-log [repo-path]

Converts an existing prompts folder to the new format. For each file, looks up the commit on which it was first added (git log --follow --diff-filter=A) and commits it as <commit-hash>-<title-with-dashes-and-lowercase>.md in the prompt-log branch, using the same commit-message convention as log-prompt. Files with no discoverable creation commit are reported and skipped. On success, deletes the old prompts/ folder and its files.

Alias

Add an alias to each command:

  • init-prompt-log → ipl
  • create-prompt → crp (existing)
  • prompt-with-pi → pwp
  • log-prompt → lop
  • list-prompts → lp (existing)
  • edit-prompt → ep
  • show-prompt → shp
  • convert-prompts-folder-to-prompt-log → cpfpl

Docs

Update library.md with the commands in the LLM section. Register the help row in the task.template file.

Worklog

  • Created new bin scripts: init-prompt-log, prompt-with-pi, log-prompt, edit-prompt, show-prompt, convert-prompts-folder-to-prompt-log
  • Rewrote bin/create-prompt to output prompt.md directly with author from git log
  • Rewrote bin/list-prompts to read from tmp/prompt-log worktree
  • Updated prompt.md.template with author field
  • Added aliases and verified no collisions with existing aliases
  • Tested full workflow: init → create → store → list → edit → show → convert
  • Updated library.md and task.template with all new commands
  • Added delete-prompt command (dp alias) with fzf selection and commit/push support
  • commit_ref is injected by log-prompt only, not by create-prompt
  • log-prompt now errors if worktree is missing instead of auto-creating it
  • Added comment documenting the empty-tree hash in init-prompt-log
  • Sorted fzf dialogs by date (newest first) in edit-prompt, show-prompt, and delete-prompt