Archaeology logo

Archaeology

Organization
ai-analyst-lab
archaeology

Retrieve proven SQL patterns, table cheatsheets, and join patterns from .knowledge/query-archaeology/ so past work gets reused. Fire as a pre-flight step before writing ANY SQL. Also trigger on "do we have a known query for X", "how do we usually join these tables", "have we computed this metric before". If the store is empty or missing, exit silently. Also owns the writer convention: after a validated analysis, curate the final SQL here.

Overview

Publisherai-analyst-lab
Repositoryai-analyst-plugin
Skill namearchaeology
Stars
34
Forks
13
Bundled files
Instructions only
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by ai-analyst-lab on GitHub. Read the source before you install it.

Installation

Install the Archaeology AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/ai-analyst-lab/ai-analyst-plugin/tree/main/ai-analyst-plus/skills/archaeology
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/ai-analyst-lab/ai-analyst-plugin.git /tmp/ai-analyst-plugin
mkdir -p .claude/skills
cp -r /tmp/ai-analyst-plugin/ai-analyst-plus/skills/archaeology .claude/skills/archaeology
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Archaeology in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Archaeology on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Archaeology is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Skill: Query Archaeology

Purpose

Retrieve proven SQL patterns, table cheatsheets, and join patterns from the query archaeology store so agents reuse validated work instead of writing SQL from scratch. The skill also defines the store's local write path: after a validated analysis, the final SQL is curated back into the store (the Writer Convention below), which is what makes the retrieval loop close.

When to Use

  • Automatically before any analysis agent writes SQL (pre-flight step)
  • Manually when the user asks about known patterns for a table or join
  • After a validated analysis, to curate the proven SQL (Writer Convention)

Instructions

Step 1: Check the Index

Read .knowledge/query-archaeology/curated/index.yaml. Parse counters: cookbook_entries, table_cheatsheets, join_patterns.

If all three are zero (or the file is missing), stop here. Return nothing and do not mention archaeology to the user.

Step 2: Identify Search Terms

From the current analysis context, extract:

  • Table names the agent is about to query (e.g., orders, events)
  • Query intent tags (e.g., funnel, retention, revenue, cohort)

Step 3: Search the Three Stores

Search each store that has entries (per index counts). Match using case-insensitive substring -- order matches orders, order_items.

3a. Cookbook (curated/cookbook/*.yaml)

For each file, check:

  • tables array -- any element contains a search table name as substring?
  • tags array -- any element matches a query intent tag?

Extract on match: title, sql, tables, tags, and any caveats/notes.

3b. Table Cheatsheets (curated/tables/*.yaml)

For each file, check:

  • table_name contains a search table name as substring?

Extract on match: table_name, grain, primary_key, common_filters, gotchas, common_joins.

3c. Join Patterns (curated/joins/*.yaml)

For each file, check:

  • tables array -- at least two elements match search table names?
  • If only one search table, match if tables contains it as substring.

Extract on match: tables, join_sql, cardinality, notes, validated.

Step 4: Format Results

Return matched entries as a fenced context block. Omit sections with no matches.

--- QUERY ARCHAEOLOGY CONTEXT ---

## Cookbook Patterns
### {title}
Tables: {tables}  |  Tags: {tags}
```sql
{sql}

Caveats: {caveats or "none"}

Table Cheatsheets

{table_name}

  • Grain: {grain}
  • Primary key: {primary_key}
  • Common filters: {common_filters}
  • Gotchas: {gotchas}
  • Common joins: {common_joins summary}

Join Patterns

{tables[0]} <-> {tables[1]}

Cardinality: {cardinality} | Validated: {validated}

sql
{join_sql}

Notes: {notes}

--- END ARCHAEOLOGY CONTEXT ---


### Step 5: Agent Handoff

Pass the formatted block as additional context to the analysis agent. The
agent should prefer archaeology SQL over writing from scratch, respect any
gotchas listed, and note in working files when an archaeology pattern was used.

## Writer Convention: Curate After a Validated Analysis

Retrieval only pays off if something writes. After an analysis is validated
(the triangulation checks pass and the finding ships), curate the final proven
SQL into the store:

1. Allocate the next entry id `CK-{NNN}`: scan
   `.knowledge/query-archaeology/curated/cookbook/` for the highest existing
   number and increment (start at `CK-001` for an empty store).
2. Write `.knowledge/query-archaeology/curated/cookbook/{entry_id}.yaml` with:
   `id`, `title` (what the query answers), `description`, `sql` (the final
   validated SQL), `dataset`, `tables`, `tags` (query intent tags such as
   `funnel`, `retention`, `revenue`), `source_analysis` (the analysis brief or
   `.knowledge/analyses/` run-record filename), `created_at` and `last_used`
   (today), `use_count: 0`. This is the same cookbook format notion-ingest
   writes, so imported and locally curated entries live side by side.
3. Create `curated/index.yaml` if it is missing (counters `cookbook_entries`,
   `table_cheatsheets`, `join_patterns`, all starting at 0), then increment
   `cookbook_entries`.

Curate one entry per validated headline query, not every intermediate query.
Skip exploratory SQL and one-off sanity checks.

## Anti-Patterns

1. **Never mention archaeology when the store is empty** -- silent skip
2. **Never require exact matches** -- always substring so `order` finds `orders`
3. **Never load all files eagerly** -- check index counts first, skip zero stores
4. **Retrieval never modifies archaeology files** -- the pre-flight path is
   read-only; only the Writer Convention appends entries, and only after
   validation
5. **Never block analysis if retrieval fails** -- archaeology is additive, not a gate

Frequently asked questions

What does the Archaeology AI skill do?

Retrieve proven SQL patterns, table cheatsheets, and join patterns from .knowledge/query-archaeology/ so past work gets reused. Fire as a pre-flight step before writing ANY SQL. Also trigger on "do we have a known query for X", "how do we usually join these tables", "have we computed this metric before". If the store is empty or missing, exit silently. Also owns the writer convention: after a validated analysis, curate the final SQL here.

Why use Archaeology on TypingMind?

Because you install it once and use it with any model. Archaeology is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Archaeology in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/ai-analyst-lab/ai-analyst-plugin/tree/main/ai-analyst-plus/skills/archaeology. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Archaeology?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Archaeology?

As many as you like. As long as a model supports skills, you can use Archaeology with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Archaeology AI skill free?

Yes. It is published on GitHub by ai-analyst-lab under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇