|
| 1 | +--- |
| 2 | +title: "Your Knowledge Base Grew. Here's How to Keep It Honest." |
| 3 | +description: "Using Basic Memory's schema system to bring consistency to organic knowledge bases — without migration scripts or upfront planning." |
| 4 | +--- |
| 5 | + |
| 6 | +You started with a few notes. Then a few dozen. Now you have hundreds, and you've noticed something: your AI writes "person" notes three different ways. |
| 7 | + |
| 8 | +Some have a `[name]` observation. Some use `[full_name]`. A few skip the name entirely and put it in the title. Relations are worse — `works_at`, `employed_by`, `employer`, `company` — four ways to say the same thing. |
| 9 | + |
| 10 | +This is normal. Knowledge bases grow organically. You don't sit down on day one and design a schema for every note type you'll ever write. You write what you need, when you need it, and structure emerges from use. |
| 11 | + |
| 12 | +The problem is that inconsistency compounds. Your AI can't reliably query "all people and their employers" if the relation type varies across notes. Metadata search returns incomplete results when some notes use `status: active` and others use `state: in-progress`. |
| 13 | + |
| 14 | +The schema system fixes this — not by forcing structure upfront, but by observing what you've already written and codifying the patterns. |
| 15 | + |
| 16 | +--- |
| 17 | + |
| 18 | +## Step 1: Discover What You Have |
| 19 | + |
| 20 | +Start by asking your AI to look at what exists: |
| 21 | + |
| 22 | +``` |
| 23 | +"I've been writing a lot of person notes. Can you figure out |
| 24 | +what they have in common?" |
| 25 | +``` |
| 26 | + |
| 27 | +Behind the scenes, the AI runs `schema_infer` on your person notes. It analyzes observation categories, relation types, and frontmatter fields across every note with `type: person`. Then it proposes a schema: |
| 28 | + |
| 29 | +``` |
| 30 | +Done! I analyzed 45 person notes. Here's what I found: |
| 31 | +
|
| 32 | +Required (in 90%+ of notes): |
| 33 | + - name: string — full name |
| 34 | + - role: string — job title or function |
| 35 | +
|
| 36 | +Optional (in 25-89%): |
| 37 | + - works_at: Organization — employer |
| 38 | + - expertise: string[] — areas of knowledge |
| 39 | + - email: string — contact email |
| 40 | +
|
| 41 | +Common relations: |
| 42 | + - works_at → Organization (37 notes) |
| 43 | + - collaborates_with → Person (12 notes) |
| 44 | +
|
| 45 | +Want me to create this as a schema? |
| 46 | +``` |
| 47 | + |
| 48 | +## Step 2: Create the Schema |
| 49 | + |
| 50 | +Say yes. The AI creates a schema note — which is just a regular markdown file: |
| 51 | + |
| 52 | +```yaml |
| 53 | +--- |
| 54 | +title: Person |
| 55 | +type: schema |
| 56 | +entity: person |
| 57 | +version: 1 |
| 58 | +schema: |
| 59 | + name: string, full name |
| 60 | + role?: string, job title |
| 61 | + works_at?: Organization, employer |
| 62 | + expertise?(array): string, areas of knowledge |
| 63 | + email?: string, contact email |
| 64 | +settings: |
| 65 | + validation: warn |
| 66 | +--- |
| 67 | +``` |
| 68 | + |
| 69 | +This lives in your knowledge base alongside everything else. Open it in VS Code, Obsidian, any editor. It's a note about how notes should look. |
| 70 | + |
| 71 | +The `?` marks optional fields. `validation: warn` means the schema advises but doesn't block. Your AI reads this schema when creating new person notes and follows it as a guide. |
| 72 | + |
| 73 | +## Step 3: Validate What Exists |
| 74 | + |
| 75 | +Now check your existing notes against the schema: |
| 76 | + |
| 77 | +``` |
| 78 | +"How do my existing person notes look against that schema?" |
| 79 | +``` |
| 80 | + |
| 81 | +The AI runs `schema_validate`: |
| 82 | + |
| 83 | +``` |
| 84 | +42 of 45 person notes pass validation. |
| 85 | +
|
| 86 | +3 issues found: |
| 87 | + - "John Smith" — missing [name] observation (name is in title only) |
| 88 | + - "Dr. Sarah Chen" — uses [full_name] instead of [name] |
| 89 | + - "Bob (contractor)" — missing [role] observation |
| 90 | +
|
| 91 | +Want me to fix these? |
| 92 | +``` |
| 93 | + |
| 94 | +No migration script. No database alteration. The AI reads each note, identifies what's missing or inconsistent, and offers to edit them. You approve or adjust. |
| 95 | + |
| 96 | +## Step 4: Detect Drift Over Time |
| 97 | + |
| 98 | +A month later, run `schema_diff`: |
| 99 | + |
| 100 | +``` |
| 101 | +"Has my person note format drifted from the schema?" |
| 102 | +``` |
| 103 | + |
| 104 | +``` |
| 105 | +Drift detected in Person schema: |
| 106 | +
|
| 107 | +New fields found in notes (not in schema): |
| 108 | + - linkedin_url (appeared in 8 notes) |
| 109 | + - department (appeared in 15 notes) |
| 110 | +
|
| 111 | +Declared fields with low usage: |
| 112 | + - email (only 12% of notes — consider making optional or removing) |
| 113 | +
|
| 114 | +Relation type variations: |
| 115 | + - "employed_by" used 3 times (schema says "works_at") |
| 116 | +``` |
| 117 | + |
| 118 | +Now you decide: add `department` to the schema because it's useful? Normalize `employed_by` back to `works_at`? Drop `email` because nobody uses it? The schema evolves with your knowledge base, not against it. |
| 119 | + |
| 120 | +--- |
| 121 | + |
| 122 | +## The Full Workflow Loop |
| 123 | + |
| 124 | +This is what schema-managed knowledge looks like in practice: |
| 125 | + |
| 126 | +1. **Write freely** — don't worry about structure upfront |
| 127 | +2. **Infer** — let the AI discover patterns in what you've written |
| 128 | +3. **Codify** — create a schema from those patterns |
| 129 | +4. **Validate** — check existing notes and fix outliers |
| 130 | +5. **Create** — new notes follow the schema automatically |
| 131 | +6. **Drift** — periodically check if reality has diverged from the definition |
| 132 | +7. **Evolve** — update the schema to match how your knowledge base actually works |
| 133 | + |
| 134 | +It's the same cycle that good database teams follow — observe, define, validate, evolve — but applied to a plain-text knowledge base managed through conversation. |
| 135 | + |
| 136 | +## Why Schemas Are Just Notes |
| 137 | + |
| 138 | +This was a deliberate design decision. Schemas could have been configuration files, database tables, or API-only constructs. We made them notes because: |
| 139 | + |
| 140 | +- **You can read them.** Open the file, see exactly what "Person" means in your knowledge base. |
| 141 | +- **You can edit them.** Change a field name in your editor, save, done. |
| 142 | +- **Your AI can read them.** When creating a new person note, the AI checks the schema and follows it. |
| 143 | +- **They're versioned.** Git tracks changes. You can see how your schemas evolved over time. |
| 144 | +- **They're searchable.** `search_notes(metadata_filters={"type": "schema"})` finds all your schemas. |
| 145 | + |
| 146 | +Schemas aren't a separate system bolted onto your knowledge base. They're part of it. |
| 147 | + |
| 148 | +## Real-World Example: Task Management |
| 149 | + |
| 150 | +Schemas shine for workflow note types. Here's a task schema: |
| 151 | + |
| 152 | +```yaml |
| 153 | +--- |
| 154 | +title: Task |
| 155 | +type: schema |
| 156 | +entity: task |
| 157 | +version: 1 |
| 158 | +schema: |
| 159 | + description: string, what needs to be done |
| 160 | + status: string, current status (active/blocked/done) |
| 161 | + priority?: string, urgency level |
| 162 | + assigned?: string, who owns this |
| 163 | + current_step?: string, where we are in the process |
| 164 | + context?: string, accumulated working state |
| 165 | + blocked_by?: string, what's preventing progress |
| 166 | +settings: |
| 167 | + validation: warn |
| 168 | +--- |
| 169 | +``` |
| 170 | + |
| 171 | +Every task note your AI creates follows this structure. When you search for active tasks, you know `status` exists and is consistent. When your AI resumes work after a context reset, it reads `current_step` and `context` to pick up where it left off. |
| 172 | + |
| 173 | +The schema didn't require upfront planning. You wrote a few task notes, noticed they had common fields, inferred a schema, and now every future task is consistent. |
| 174 | + |
| 175 | +--- |
| 176 | + |
| 177 | +[Schema system guide →](/concepts/schema-system) |
| 178 | +[Metadata search →](/blog/metadata-search) |
| 179 | + |
| 180 | +--- |
| 181 | + |
| 182 | +*Basic Memory is local-first AI knowledge infrastructure. Structure when you need it, plain text always. [Get started →](https://basicmemory.com)* |
0 commit comments