Sub topic 12
Templates and Simple Automation
This chapter covers how to cut the cost of two repeated actions in an idea file: capturing a new idea and finding old ones. It assumes you already keep a single inbox, write entries in a consistent format, and use a small set of tags. It also assumes you can open a terminal and run a short script. You do not need to program well. Every example here is short enough to read in full.
What automation is for
Automation in an idea file has two jobs. It lowers friction at the moment of capture, and it removes small chores from review. It is not meant to organize your ideas for you or to decide which ideas matter. Those decisions are the point of the review routine, and a script that makes them would hide the judgment you are trying to practice.
A useful rule is to automate an action only after you have done it by hand many times. By then you know what the action really is. If you automate too early, you build tools around habits you do not have yet.
| Action | Automate? | Reason |
|---|---|---|
| Appending a dated line to the inbox | Yes | Same every time, and speed matters |
| Creating a full entry from a template | Yes | Saves retyping headings and the date |
| Finding every idea with a tag | Yes | Search is mechanical |
| Deciding which ideas to promote | No | This is judgment, and it is the purpose of review |
| Choosing tags for a new idea | Mostly no | Tagging by hand keeps you thinking about the idea |
Quick capture from the command line
The fastest capture is one command that appends a line to your inbox file. This shell function does that.
# Add to ~/.bashrc or ~/.zshrc
idea() {
mkdir -p "$HOME/ideas"
printf '%s | %s\n' "$(date +%Y-%m-%d)" "$*" >> "$HOME/ideas/inbox.md"
}
# Usage:
# idea "Short guide on explaining recursion with a family tree"Each part has a purpose:
mkdir -pcreates the folder if it is missing and does nothing if it exists. The first capture never fails because of a missing directory.date +%Y-%m-%dwrites the date as2026-11-28. This format sorts correctly as plain text, so sorting the file sorts it by time."$*"joins everything you typed afterideainto one string. You can leave out the quotes around your idea, but quotes protect you from the shell reading characters such as#,&, or;as something other than text.>>appends. A single>would overwrite the whole inbox. If you ever edit this function, check that you still have two arrows.
After you add the function to your shell configuration file, open a new terminal or run source ~/.zshrc (or source ~/.bashrc). Then test it with a throwaway idea and read the file back with tail -n 3 ~/ideas/inbox.md.
Edge cases in quick capture
- Quotes inside the idea. If your idea contains an apostrophe, such as
idea "Don't forget the loop case", double quotes handle it. Single quotes around that text would break. - A tag with a hash sign. Writing
idea "Recursion with ancestors #teaching"works when the text is inside quotes. Without quotes, many shells treat#as the start of a comment and drop the rest of the line, so your tag disappears silently. - Empty input. Running
ideawith no text appends a line with only a date. You can guard against this by adding[ -z "$*" ] && returnas the first line inside the function. - Sync conflicts. If the inbox lives in a folder synced by a cloud service, appending from two devices at once can create a conflicted copy. Capture on one device at a time, or keep one inbox file per device and merge them during review.
Entry templates
A quick line is enough for the inbox. When you promote an idea during review, you want a fuller entry. A template is a ready-made skeleton, so you fill in blanks and do not decide the structure every time. This template records the idea, why it matters, and a next step.
# Idea: Recursion explained with a family tree
- Captured: 2026-11-28
- Tags: #teaching #programming
- Status: inbox
## The idea
Use ancestors as an example of a function that calls itself on a smaller input.
## Why it might matter
Most recursion examples use factorials, which many learners find abstract.
## Next step
Sketch a small tree and write the base case in one sentence.Notice the design choices:
- The Status field has a small set of values, such as
inbox,developing,project, andarchived. Keep the set small, or the field stops meaning anything. - The Next step section forces a concrete action. An idea with no next step usually stays an idea forever.
- The metadata uses
- Key: valuelines, so a search forStatus: developingfinds every idea at that stage.
You can store the template in your notes app's template feature, or as a file called _template.md that you copy. The underscore keeps it at the top of an alphabetical file list.
Creating an entry from the template with a script
Copying and editing by hand works, but a short function can fill in the date and a file name for you.
newidea() {
local title="$*"
local slug
slug=$(printf '%s' "$title" | tr '[:upper:]' '[:lower:]' | tr -cs 'a-z0-9' '-' | sed 's/^-//; s/-$//')
local file="$HOME/ideas/$(date +%Y-%m-%d)-${slug}.md"
mkdir -p "$HOME/ideas"
cat > "$file" <<EOF
# Idea: ${title}
- Captured: $(date +%Y-%m-%d)
- Tags:
- Status: inbox
## The idea
## Why it might matter
## Next step
EOF
echo "$file"
}The slug line turns a title such as Recursion with a family tree into recursion-with-a-family-tree. It lowercases the text, replaces every run of characters that are not letters or digits with a hyphen, and trims hyphens from the ends. The function prints the new path, so you can open it with $EDITOR "$(newidea Recursion with a family tree)".
One caution: this function uses > on purpose, because it writes a new file. If two ideas share a title on the same day, the second silently replaces the first. For a personal file this is rare, but you can prevent it by adding [ -e "$file" ] && { echo "exists: $file"; return 1; } before the cat line.
Searching by tag
Tags only help if you can pull them back out. This Python script prints every line in the Markdown files of an ideas folder that contains a given tag.
import sys
from pathlib import Path
tag = sys.argv[1]
for path in sorted(Path("ideas").glob("*.md")):
lines = path.read_text(encoding="utf-8").splitlines()
for number, line in enumerate(lines, start=1):
if f"#{tag}" in line:
print(f"{path}:{number}: {line}")Run it from the folder that contains ideas, for example python find_tag.py teaching. The output looks like ideas/inbox.md:4: 2026-11-28 | Recursion with a family tree #teaching. The path:line: prefix is the same shape that many editors and terminals recognize, so you can often click it to jump to the line.
Known limits of this script
- Prefix matches. Searching for
teachalso matches#teachingand#teacher, because the test is a plain substring check. If your tags share prefixes, change the test to a regular expression with a word boundary, such asre.search(rf"#{re.escape(tag)}\b", line). - Case.
#Teachingand#teachingare different to this script. Choose lowercase tags as a rule, and the problem does not appear. - Subfolders.
glob("*.md")looks only at the top level of the folder. Userglob("*.md")to include subfolders, which will also include your archive. Decide whether you want that. - Missing folder. If
ideasdoes not exist, the script prints nothing and gives no error, which can look like "no matches." Check the folder path first when results seem too few.
If you already use a tool such as grep, grep -rn "#teaching" ~/ideas does nearly the same job in one line. The script is worth keeping only if you plan to extend it, for instance to filter by Status.
How the pieces fit together
The three tools sit at different points in the life of an idea.
Note that the loop from tag search back to review is deliberate. Automation should feed your review, not replace it.
Keeping automation from becoming a project
Idea-file tooling has its own failure mode: spending the creative time on the tooling. Watch for these signs.
- You have rewritten the capture function more than twice in a month.
- You are adding fields to the template that you never fill in.
- You have more scripts than you used in the last review.
A practical limit is to keep every script short enough to read at a glance, and to keep a plain-text fallback. If your scripts break, or you are on a machine without them, you should still be able to open the inbox file in any editor and type a line. Plain text outlives every tool, which is the main reason to build on it.
Summary of choices
| Need | Simple option | Step up when needed |
|---|---|---|
| Capture in seconds | `idea` shell function | A phone shortcut that appends to the same file |
| Consistent entries | Copy `_template.md` | `newidea` function |
| Find by tag | `grep -rn` | `find_tag.py` with filters |
| Avoid overwriting | Unique date-based names | Existence check before writing |
Exercise
The idea function uses >> to write to the inbox. A friend copies it but types > by mistake. What happens the next time they capture an idea, and how would they notice?
Show answer
The single > replaces the whole contents of inbox.md with the new line each time, so every earlier idea is lost. They would notice when tail or an editor shows only one line in the inbox. Restoring from a backup or sync history is the only recovery, which is why the inbox should be backed up.
Exercise
You search with python find_tag.py teach and get lines tagged #teaching and #teacher. Why, and what small change makes the script match only the exact tag?
Show answer
The script uses a substring test (f"#{tag}" in line), and #teach is a prefix of both tags. Replace the test with a regular expression that ends at a word boundary, such as re.search(rf"#{re.escape(tag)}\b", line), and add import re at the top.
Exercise
Name one action in your own idea routine that you should not automate, and give a reason from this chapter.
Show answer
Deciding which ideas to promote during review. It is a judgment call, and it is the purpose of the review routine, so a script that made the choice would remove the thinking you want to practice. Choosing tags by hand is another acceptable answer, because it keeps you engaged with the idea.