- Guide for Dummies: How to Build Your First Self-Improving AI Agent to Manage Your Obsidian Vault with Antigravity
- 1. The ABC of Agents in Obsidian: What Are We Building?
- 2. Preparing the Ground in Antigravity
- 3. The Heart of the System: Configuring .antigravityrules
- 4. Designing the "Office": Your Sub-agents via Skills
- 5. The Self-Improvement Loop: How Does It Work in Practice?
- 6. Step-by-Step Implementation Plan (Your Roadmap)
- 7. Golden Tips for Beginners
Have you ever wished you had a personal knowledge base or wiki that not only stores your notes, but also organizes your new files, extracts information automatically, and learns from its own labeling mistakes? That is exactly what you get when you leave your Obsidian vault in the hands of a self-improving AI agent.
If you have never configured an agent before or do not understand how AI interacts with your local files, this practical guide will walk you through it from scratch. We will use Antigravity 2.0, a standalone desktop application designed to orchestrate local agents directly and without writing complex code.
1. The ABC of Agents in Obsidian: What Are We Building?
Before diving into configuration, let's ground the key concepts using your own note structure.
The Role of the Architect
Instead of using a basic chatbot where you copy and paste text manually, we are going to create an "LLM Wiki Architect." This agent has an active role and direct access to your vault. Its goal is to read your folders, process new attachments (like PDFs in your inbox), generate the corresponding notes using your YAML templates, and automatically update your indexes. It operates through a continuous control loop that evaluates whether the result meets formatting and quality requirements before finishing a task.
Separating Responsibilities: The Agent Team
Ingesting a document, checking its format, linking it in the main index, and updating the knowledge base is too much work for a single prompt. Instead, we delegate tasks to a team of specialized skills that communicate with each other. By isolating each actor, we prevent the LLM's context window from getting cluttered with contradictory instructions. You can read more about this strategy in our analysis on why agent teams prevent attention drop in complex tasks.
The 4 Layers of Memory Applied to Your Vault
For your agent to work consistently, we structure its memory by mapping it directly to your Obsidian organization:
- Working Memory: The specific note or attachment that the agent is analyzing in the current chat thread right now.
- Semantic Memory: The local vector search database indexing your entire vault. This allows the agent to find conceptual relationships between your old notes to answer questions or link ideas.
- Episodic Memory: The execution history and changes, recorded chronologically in a log file (
log.md). - Procedural Memory: The operational rules that dictate how to structure the vault. These immutable directives are defined in the
.antigravityrulesfile in the root of your project. You can find more technical details about this state management in the guide on architecture and memory of AI agents.
2. Preparing the Ground in Antigravity
Antigravity 2.0 is a standalone desktop application that dispenses with complex visual wizards in favor of a file-driven architecture. You do not configure agents by filling out forms in a GUI; the system reads your local directory structure automatically.
- Installation: Download and install Antigravity 2.0 on your computer.
- Import Your Vault: Open the application, go to the top File menu, and click Create Project (or use the shortcut
Ctrl+Shift+Oto open a new session). Select the root folder of your Obsidian vault. - Project Control: In the left sidebar, you will see the list of your active projects. Clicking on your indexed vault will link the main chat session to that directory, ready to run local directives.
3. The Heart of the System: Configuring .antigravityrules
Your main agent's behavior is governed by a rules file written in Markdown. Create a file named .antigravityrules directly in the root of your Obsidian vault. Antigravity will load and inject these directives into the agent as soon as it detects the directory opening.
Copy and paste the following exact configuration into your .antigravityrules file:
# Soul Core: LLM Wiki Architect
You are the main agent (Architect) of this Obsidian Vault. Your goal is to incrementally build, maintain, and improve this knowledge base. You are capable of auditing yourself and optimizing your own processes.
## 1. SAFETY AND STOP RULES
- **Immutability:** You are FORBIDDEN from modifying the original files in `900 - Attachments/`.
- **Stop Criteria:** Stop your iteration processes on a task only if:
1. The extraction or synthesis is completed with absolute success.
2. The quality improvement between your previous attempt and the current one is less than 5%.
3. The user explicitly writes the word "STOP".
- **Exponential Compression:** Keep your answers direct and periodically summarize your own operational context to remain efficient.
## 2. SYSTEM FILES AND STRUCTURE (Root)
- `index.md`: Content catalog. ALWAYS read it before answering queries to orient yourself.
- `log.md`: Chronological log. Add a line here every time you process a new source.
- `knowledge-base.md`: Your learning log. Every time you discover an extraction error or a better way to process user data, document it here for your future interactions.
- `.antigravityrules`: Your immutable operational directives.
## 3. VAULT DIRECTORIES
- `000 - Inbox/`: The only default write folder for new notes.
- `100 - Active Projects/` | `200 - Life Areas/` | `300 - Resources and Training/` | `400 - People and Contacts/` | `800 - Calendar/`
- `900 - Attachments/`: Central repository for immutable files (PDFs, images).
- `999 - Templates/`: Base models.
## 4. ARCHITECT OPERATIONS
### A. Ingestion and Self-Correction
When processing a new source (e.g., a PDF in Attachments):
1. Extract data using your established YAML templates.
2. If you detect an error in your own extraction or the user corrects you, analyze the failure, update your temporary instructions, and try again.
3. Intelligent Date-Based Naming: If the document has a specific date (pay slips, invoices, meeting minutes), name the Markdown file starting with a date prefix (`YYYY`, `YYYYMM`, or `YYYYMMDD` as appropriate, e.g., `202606 - Pay Slip.md`). If it is a general reference note (recipes, guides), do not use date prefixes.
4. Create the final `.md` file in `000 - Inbox/`.
5. Update `log.md` and add the new note to `index.md`.
### B. Query (Intelligent RAG)
When answering questions, query `index.md` first and limit deep reading to the **top-20 most relevant results** to avoid saturating your memory. Synthesize the information; if you generate new knowledge, archive it as a new note in the vault.
### C. Self-Improvement (The Loop)
If during your tasks you discover a recurring pattern (e.g., an optimal way to format meeting minutes or extract invoices), write that new rule in `knowledge-base.md` so your "future self" is more efficient.
4. Designing the "Office": Your Sub-agents via Skills
To manage the vault flow without saturating the main conversation context, we will define specialized sub-agents. In Antigravity, a sub-agent is a Skill packaged in a project subdirectory.
Create the .agents/ folder in your root directory, and inside it, create the skills/ folder. Each sub-agent must be placed in its own subdirectory and contain a file named SKILL.md structured as follows (with its required YAML header so the tool recognizes it):
A. Researcher
Create the file .agents/skills/researcher/SKILL.md and integrate the financial extraction rules:
---
name: researcher
description: Searches information, reads attachments, and investigates the Vault
---
# Researcher
Your sole goal is to extract pure and relevant data. Use the RAG Search tool or read files inside "900 - Attachments/". Filter out unnecessary noise from the original document and generate a clean, structured report. Do not try to write or modify notes.
If the attachment is a financial document (pay slip or invoice), you must extract the following key fields to pass to the Coder:
- Document Type (pay slip or invoice)
- Date (YYYY-MM-DD)
- Entity (Issuer)
- Gross Amount (Value)
- Taxes Percentage (%)
- Net Amount (Value)
B. Coder / Writer
Create the file .agents/skills/coder/SKILL.md and integrate linking and cross-referencing rules:
---
name: coder
description: Writes and edits notes in Markdown format with YAML frontmatter in Obsidian
---
# Coder / Writer
Your goal is to write Markdown notes in "000 - Inbox/". Use templates from "999 - Templates/" and ensure correct YAML formatting in the frontmatter.
Special Ingestion Rules:
1. If the data comes from a financial file, insert the mandatory frontmatter:
```yaml
type: document/payslip or document/invoice
date: YYYY-MM-DD
entity: [Issuer]
gross_amount: [Amount]
taxes_percentage: [Percentage]
net_amount: [Amount]
```
2. Add a feedback link pointing back to the original attachment: `[[Filename.pdf]]`.
3. Search for related existing notes (vehicles, active projects, global finances) and edit them to add the extracted information, ensuring you do not erase pre-existing data.
C. Classifier (Organizational Classifier)
Create the file .agents/skills/classifier/SKILL.md. This agent combines the PARA system structure (100-Projects, 200-Areas, 300-Resources) with the numerical logic of Johnny.Decimal to catalog notes:
---
name: classifier
description: Classifies notes according to Vault standards combining PARA and Johnny.Decimal
---
# Classifier
Your goal is to analyze the note created by the Coder and propose its final location. Map the note against the Vault structure.
Classification Rules:
1. Identify the main folder (PARA) and the corresponding decimal numerical folder. Examples:
- Projects (100) -> `100 - Active Projects/`
- Finances (21.00) -> `200 - Life Areas/21.00 Finances/21.01 Pay Slips/`
- Programming (31.00) -> `300 - Resources and Training/31.00 Programming/31.02 Go/`
2. Intelligent Date-Based Naming: Determine if the document has a specific date or represents a concrete temporal record (pay slips, invoices, contracts, meeting minutes). If so, propose the file name prepended with a date prefix in YYYY, YYYYMM, or YYYYMMDD format (e.g., "202606 - Pay Slip.md" or "20260713 - Meeting Minutes.md"). If the note is general reference (recipes, manuals, guides), do not add date prefixes to the name.
3. Add two temporary YAML properties to the note frontmatter for the user to validate:
- `proposed_path`: Suggested absolute path (e.g., "200 - Life Areas/21.00 Finances/21.01 Pay Slips/21.01 - Pay Slip June 2026.md")
- `organizational_reasoning`: Brief explanation of why this category was assigned.
D. Critic
Create the file .agents/skills/critic/SKILL.md and integrate the vault linting script:
---
name: critic
description: Analyzes quality, format, links, and executes lint_wiki.py
---
# Critic
Your goal is to audit the formatting of new notes and validate the consistency of the classification suggested by the Classifier. Verify that no immutable files are altered in "900 - Attachments/".
Maintenance Rule (Linting):
When a health check or cleanup of the Vault is requested, run the diagnostic script by executing:
`python .agents/skills/llm_wiki/scripts/lint_wiki.py`
Analyze the script output (broken links, orphan notes, contradictions) and present the detailed health report to the user.
E. Memory Manager
Create the file .agents/skills/memory_manager/SKILL.md and integrate the catalog and log formats:
---
name: memory_manager
description: Manages index.md, log.md, and performs context compression
---
# Memory Manager
Your goal is to register completed actions in the Vault.
Logging Rules:
1. Add the link to "index.md" along with a one-line summary of the new note.
2. Record the event in the "log.md" logbook using exactly this format:
`## [YYYY-MM-DD] ingest | document_type: Note_Name`
3. Periodically summarize your working memory to keep the context clean.
F. Planner
Create the file .agents/skills/planner/SKILL.md and paste the following:
---
name: planner
description: Plans and breaks down complex Vault tasks into ordered steps
---
# Planner
Your goal is to break down the user's initial request into an ordered sequence of steps. Identify which sub-agents or skills are required at each phase of the plan.
Note: If you leave these folders empty or without their respective YAML headers, Antigravity will not be able to match the skills, and your Architect agent will have to define and invoke them dynamically in each session using internal tool calls (define_subagent and invoke_subagent). To ensure persistence, filling in the Markdown files above is mandatory.
5. The Self-Improvement Loop: How Does It Work in Practice?
Imagine you drop a new Q1 financial report PDF into 900 - Attachments/ and write in the Antigravity chat: "Ingest the Q1 financial report and create its descriptive note". This is how the self-improvement loop operates:
[ User Input ]
|
v
1. PLANNING ---> The Architect designs the ingestion plan by reading `index.md`.
|
v
2. EXTRACTION ---> The Researcher reads the PDF in `900 - Attachments/` and extracts data.
|
v
3. WRITING ---> The Coder writes the Markdown draft in `000 - Inbox/`.
|
v
4. CLASSIFICATION ---> The Classifier maps the note to PARA + Johnny.Decimal and proposes the final path.
|
v
5. EVALUATION ---> The Critic validates the format and the organizational proposal. Any errors?
|
+-----+------------------------+
| |
v (If there are format errors) v (If everything is correct)
6a. AUTO-CORRECCIÓN 6b. CONSOLIDACIÓN
|-> Corrects instructions |-> Saves note, moves file, and updates `log.md` and `index.md`.
+-> Returns to step 3 (Loop) |-> Writes learnings to `knowledge-base.md`.
+-> Finishes task.
If the Critic detects that the writer forgot to add the date field in the YAML frontmatter, it will send detailed feedback back to the writer so they can fix it autonomously. If the error persists due to a prompt interpretation issue, the loop stops when the quality improvement between consecutive attempts drops below the 5% threshold, preventing infinite API token usage.
6. Step-by-Step Implementation Plan (Your Roadmap)
Do not try to build everything at once. I suggest following this structured roadmap to deploy the system incrementally:
Phase 1: Base Rules (15-30 min)
- Step 1.1: Rules file. In the root of your Obsidian vault, create a file named
.antigravityrules. - Step 1.2: Soul configuration. Paste the code from Section 3 into your new rules file.
- Step 1.3: Open in Antigravity. Open Antigravity 2.0 Desktop, select File -> Create Project, and load your vault's root folder. The system will automatically detect the rules at session startup.
Phase 2: Defining Skills (30-60 min)
- Step 2.1: Skill folders. In the root of your vault, create the
.agents/skills/directory. - Step 2.2: Sub-agent structure. Create folders named
researcher,coder,classifier,critic, andmemory_manager. - Step 2.3: Behavior files. Write the
SKILL.mdfile inside each folder, specifying its role and rules (copying the templates from Section 4). Upon saving, the main orchestrator will automatically register them as operational skills.
Phase 3: Basic Ingestion and Classification Test (1-2 hours)
- Step 3.1: Test file. Place a short PDF or text file in
900 - Attachments/. - Step 3.2: Ingestion request. In the Antigravity chat, type: "Ingest the test file and generate the corresponding note" and start the task.
- Step 3.3: Visual debugging. Monitor the console output in real-time. Watch how the Researcher reads the attachment, the Coder generates the note, the Classifier adds the decimal path proposal YAML properties, and the Critic audits the result before updating logs.
Phase 4: Automatic Semantic Indexing (RAG) (1 hour)
- Step 4.1: Background indexing. In Antigravity, the local vector database and RAG engine are completely automated. There is no manual toggle button in the GUI settings. As soon as you open your project, Antigravity begins scanning and indexing your Markdown files in the background.
- Step 4.2: Local storage. The system stores the vector embeddings inside the hidden
.cache/vector_storefolder in the root of your local project. No code or files are sent to cloud databases. - Step 4.3: RAG boundaries and exclusions. To prevent the indexer from saturating or consuming too many resources, make sure to add folders with heavy attachments, dependencies, or cache files to the project's
.gitignorefile. From then on, theresearchersub-agent can automatically use theRAG Searchtool to find conceptual information in your past notes.
Phase 5: Stress Test and Autonomous Stopping (45 min)
- Step 5.1: Conflict command. Ask the agent to run a complex ingestion task or one with requirements that contradict Obsidian templates.
- Step 5.2: Correction loop. Watch how the Critic rejects drafts due to inconsistencies and how the Coder iterates by modifying its local instructions in the background.
- Step 5.3: Stop validation. Verify in the terminal log that the process stops autonomously after a few iterations once the improvement between consecutive attempts drops below the 5% limit.
Phase 6: Automated Maintenance (45 min)
- Step 6.1: Background task. Click Scheduled Tasks in the left sidebar of the Antigravity interface.
- Step 6.2: Cron setup. Add a new task and define its recurrence with the cron expression
*/30 * * * *(run every 30 minutes). - Step 6.3: Maintenance request. Write the execution prompt: "Read the latest notes created in the inbox, compress the ingestion context, and update learnings.md with the optimized templates you learned today".
7. Golden Tips for Beginners
- Choose the right brain: For analysis and structuring tasks with Markdown files in Obsidian, connect your system to models with strong logical reasoning capabilities. We recommend selecting Gemini 1.5 Pro or Claude 3.5 Sonnet in the Antigravity model selection dropdown.
- Plugin integration: Combine your agent's work with community Obsidian plugins like Dataview or Templater. You can instruct your agent in its rule file to include specific Dataview queries in generated notes so your human-facing indexes update instantly.
- Monitor the loops: Do not leave the chat unattended during your initial tests. If you notice that the Critic and the Coder get stuck in a loop discussing minor formatting details, remember that you can type the word "STOP" in the conversation at any time to safely abort execution and adjust rules.