In the previous chapter, Autonomous Orchestration (Loki Mode), we turned our AI into a Virtual CTO that can execute complex projects.
But even the smartest CTO has a weakness: Memory.
As your project grows, the conversation history gets too long. The AI hits its "Context Window" limit (its short-term memory). It starts forgetting earlier instructions, hallucinating filenames, or losing track of the original goal.
It needs a way to store thoughts permanently.
Imagine trying to write a novel, but every time you turn the page, the previous pages are erased. You would forget the main character's name by Chapter 3.
This is how Large Language Models (LLMs) work.
If we keep the project plan inside the Chat History, it will eventually disappear. We need to move the plan out of the brain and onto the disk.
The File-Based Planning pattern forces the AI to maintain its state in Markdown files inside your project folder.
Instead of "remembering" what it did, the AI simply reads a file to see what it did.
We use three specific files to act as the AI's long-term memory.
task_plan.md (The Map): A checklist of phases and steps. The AI reads this to know where it is.findings.md (The Notebook): A place to store research, API snippets, and decisions so they don't get lost.progress.md (The Diary): A log of what happened in each session (e.g., "Tried to install X, failed, fixed it by doing Y").
You don't need to manually create these files. We have a skill for that: @planning-with-files.
When you start a complex task, tell the AI to initialize its memory.
User: "@planning-with-files Let's build a weather dashboard."
The AI runs a script that generates the three empty Markdown files in your folder.
The AI fills in task_plan.md first.
<!-- task_plan.md content -->
# Project: Weather Dashboard
## Phase 1: Setup
- [x] Initialize Node.js project
- [ ] Install React
- [ ] Set up Tailwind CSS
## Phase 2: API
- [ ] Get API Key from OpenWeather
Here is the magic. Before the AI writes any code, it reads the plan.
task_plan.md -> "Ah, I see I finished Node.js setup. Next is installing React."task_plan.md -> Marks "Install React" as [x].Even if you restart the computer, the AI knows exactly where it left off.
How do we force the AI to look at the plan? We can't just hope it remembers to do so.
We use a feature called Skill Hooks in the SKILL.md file. These are automated triggers (like database triggers) that run before or after the AI does something.
Let's look at skills/planning-with-files/SKILL.md.
# SKILL.md Frontmatter (Simplified)
name: planning-with-files
hooks:
PreToolUse:
- matcher: "Write|Edit"
hooks:
- type: command
# Force the AI to see the plan before acting
command: "cat task_plan.md | head -30"
Explanation:
matcher: Watches for when the AI tries to Write code or Edit a file.command: Before allowing the write, it runs cat task_plan.md.
Why do we need findings.md?
Imagine the AI reads a documentation page to learn how a specific API library works.
findings.md.<!-- findings.md -->
## Research: Date Library
We are using `date-fns`.
Format used: `format(new Date(), 'yyyy-MM-dd')`
Now, when the AI needs to format a date 20 turns later, it checks findings.md instead of browsing the web again. This saves time, money (tokens), and prevents errors.
When you first invoke the skill, it runs a simple bash script to set up the files. This ensures the files follow a strict template that the AI is trained to understand.
Here is a simplified version of scripts/init-session.sh:
#!/bin/bash
# simplified init script
# 1. Create the Plan
if [ ! -f "task_plan.md" ]; then
echo "# Task Plan\n\n## Phase 1\n- [ ] Todo" > task_plan.md
fi
# 2. Create the Findings
if [ ! -f "findings.md" ]; then
echo "# Findings\n\n## Key Decisions" > findings.md
fi
echo "Memory initialized. I am ready to plan."
Explanation: It checks if the files exist. If not, it creates them with the correct headers. This gives the AI a "Form" to fill out, rather than a blank page.
If you are just playing with AI, this might seem like overkill. But if you are building Software, this is essential.
task_plan.md is a constant reminder of the goal.task_plan.md and edit it manually to steer the AI in a new direction.Congratulations! You have completed the Antigravity Awesome Skills tutorial.
Let's recap your journey:
You now possess the complete architecture to turn a standard coding assistant into a professional, autonomous software engineer.
Go forth and build something awesome! ๐
Generated by Code IQ