### Project Structure Example
Source: https://github.com/1st1/lat.md/blob/main/README.md
Example directory structure showing the lat.md/ directory and source code annotations.
```text
my-project/
├── lat.md/
│ ├── architecture.md # system design, key decisions
│ ├── auth.md # authentication & authorization logic
│ └── tests.md # test specs (require-code-mention: true)
├── src/
│ ├── auth.ts # // @lat: [[auth#OAuth Flow]]
│ └── server.ts # // @lat: [[architecture#Request Pipeline]]
└── ...
```
--------------------------------
### Run lat init command
Source: https://github.com/1st1/lat.md/blob/main/lat.md/cli.md
Initiates the interactive setup wizard for lat.md. Optionally specify a directory to initialize.
```bash
lat init [dir]
```
--------------------------------
### Install lat.md CLI
Source: https://github.com/1st1/lat.md/blob/main/README.md
Install the lat.md package globally using npm.
```bash
npm install -g lat.md
```
--------------------------------
### Wiki Link Syntax
Source: https://github.com/1st1/lat.md/blob/main/templates/skill/SKILL.md
Examples of linking to other sections and source code symbols.
```markdown
See [[cli#init]] for setup details.
The parser validates [[parser#Wiki Links|wiki link syntax]].
```
```markdown
[[src/config.ts#getConfigDir]] — function
[[src/server.ts#App#listen]] — class method
[[lib/utils.py#parse_args]] — Python function
[[src/lib.rs#Greeter#greet]] — Rust impl method
[[src/app.go#Greeter#Greet]] — Go method
[[src/app.h#Greeter]] — C struct
```
--------------------------------
### JavaScript Function Example
Source: https://github.com/1st1/lat.md/blob/main/tests/roundtrip.md
A basic JavaScript function that returns a string. No specific setup is required to run this snippet.
```javascript
function hello() {
return 'world';
}
```
--------------------------------
### LLM key setup prompt
Source: https://github.com/1st1/lat.md/blob/main/lat.md/cli.md
Interactively prompts the user to paste an LLM key if one is not found in environment variables or the configuration file. Explains the need for a key for semantic search.
```bash
env var
```
--------------------------------
### Start MCP Server
Source: https://github.com/1st1/lat.md/blob/main/lat.md/cli.md
Initiates the Model Context Protocol (MCP) server over stdio. This server exposes lat.md tools to MCP-capable coding agents. Clients invoke this command directly.
```bash
lat mcp
```
--------------------------------
### Good Section Structure Example
Source: https://github.com/1st1/lat.md/blob/main/templates/AGENTS.md
Demonstrates the required structure for a lat.md section, including a concise leading paragraph.
```markdown
# Good Section
Brief overview of what this section documents and why it matters.
More detail can go in subsequent paragraphs, code blocks, or lists.
```
--------------------------------
### Section Structure Examples
Source: https://github.com/1st1/lat.md/blob/main/templates/skill/SKILL.md
Demonstrates valid and invalid section structures. Every section must have a leading paragraph before any child headings.
```markdown
# Good Section
Brief overview of what this section documents and why it matters.
More detail can go in subsequent paragraphs, code blocks, or lists.
## Child heading
Details about this child topic.
```
```markdown
# Bad Section
## Child heading
This is invalid — "Bad Section" has no leading paragraph.
```
--------------------------------
### Install lat.md CLI
Source: https://github.com/1st1/lat.md/blob/main/templates/init/lat.md
Install the lat command-line tool globally using npm. This tool is used to manage source code anchored to markdown definitions.
```bash
npm i -g lat.md
```
--------------------------------
### Get lat.md Help
Source: https://github.com/1st1/lat.md/blob/main/templates/init/lat.md
Run the lat command with the --help flag to view available options and usage instructions.
```bash
lat --help
```
--------------------------------
### Claude Code agent setup
Source: https://github.com/1st1/lat.md/blob/main/lat.md/cli.md
Configures CLAUDE.md, agent hooks, and a skill for the Claude Code agent. Hooks are synced in .claude/settings.json and a skill is generated from a template.
```bash
CLAUDE.md
```
```bash
.claude/settings.json
```
```bash
.claude/skills/lat-md/SKILL.md
```
--------------------------------
### Claude Code hook examples
Source: https://github.com/1st1/lat.md/blob/main/lat.md/cli.md
Examples of hooks for the Claude Code agent. UserPromptSubmit injects workflow reminders, and Stop reminds the agent to update lat.md.
```bash
lat hook claude UserPromptSubmit
```
```bash
lat hook claude Stop
```
--------------------------------
### Ripgrep availability check
Source: https://github.com/1st1/lat.md/blob/main/lat.md/cli.md
Checks for the presence of ripgrep (rg) for faster code scanning. Provides a tip to install it if missing.
```bash
rg
```
--------------------------------
### Python Test Specification References
Source: https://github.com/1st1/lat.md/blob/main/AGENTS.md
Example of how to reference lat.md sections within Python test code using the `# @lat:` comment. Ensure each test references its corresponding spec section.
```python
# @lat: [[tests#User login#Rejects expired tokens]]
def test_rejects_expired_tokens():
...
# @lat: [[tests#User login#Handles missing password]]
def test_handles_missing_password():
...
```
--------------------------------
### Development Commands
Source: https://github.com/1st1/lat.md/blob/main/README.md
Commands for setting up and testing the lat.md project locally.
```bash
pnpm install
pnpm build
pnpm test
```
--------------------------------
### Generate Agent Instructions
Source: https://context7.com/1st1/lat.md/llms.txt
Use the CLI to generate template files for AI coding agents.
```bash
# Generate AGENTS.md template
lat gen agents.md > AGENTS.md
# Or use the alias
lat gen claude.md > CLAUDE.md
# Example output (to stdout):
# # Before starting work
#
# - Run `lat search` to find sections relevant to your task...
# - Run `lat prompt` on user prompts to expand any `[[refs]]`...
#
# # Post-task checklist (REQUIRED — do not skip)
# ...
```
--------------------------------
### Initialize lat.md Directory
Source: https://context7.com/1st1/lat.md/llms.txt
Sets up the required directory structure and optionally generates an AGENTS.md file.
```bash
# Initialize lat.md in the current directory
lat init
# Initialize in a specific directory
lat init ./my-project
# Example output:
# ✓ Created lat.md/ directory
# ✓ Created lat.md/.gitignore
# ✓ Created lat.md/README.md
# ? Would you like to generate AGENTS.md? (Y/n)
```
--------------------------------
### CLI Commands
Source: https://github.com/1st1/lat.md/blob/main/README.md
Common commands for managing the knowledge graph, validating links, and searching.
```bash
lat init # scaffold a lat.md/ directory
lat check # validate all wiki links and code refs
lat locate "OAuth Flow" # find sections by name (exact, fuzzy)
lat section "auth#OAuth Flow" # show a section with its links and refs
lat refs "auth#OAuth Flow" # find what references a section
lat search "how do we auth?" # semantic search via embeddings
lat expand "fix [[OAuth Flow]]" # expand [[refs]] in a prompt for agents
lat mcp # start MCP server for editor integration
```
--------------------------------
### Indented Code Block
Source: https://github.com/1st1/lat.md/blob/main/tests/roundtrip.md
A block of code presented with indentation, typically used for showing code structure or examples that are part of a larger indented context.
```plaintext
indented code block line one
indented code block line two
```
--------------------------------
### Gitignore and MCP configuration
Source: https://github.com/1st1/lat.md/blob/main/lat.md/cli.md
Adds the .claude directory and .mcp.json to .gitignore. Registers the MCP server in .mcp.json.
```bash
.gitignore
```
```bash
.mcp.json
```
--------------------------------
### Find Sections by Name
Source: https://context7.com/1st1/lat.md/llms.txt
Locates documentation sections using exact, partial, or fuzzy matching.
```bash
# Find a section by exact name
lat locate "cli#search#Indexing"
# Find by partial name (subsection match)
lat locate "Indexing"
# Fuzzy matching handles typos
lat locate "Indxing"
# Example output:
# Results for "Indexing":
#
# 1. cli#search#Indexing
# Defined in lat.md/cli.md:129-141
# > Sections are extracted via loadAllSections() + flattenSections()...
```
--------------------------------
### Expand Wiki References for Agents
Source: https://context7.com/1st1/lat.md/llms.txt
Resolves wiki links in text to full paths and context, useful for preparing prompts for AI agents.
```bash
# Expand refs in a prompt
lat prompt "Please fix the bug in [[OAuth Flow]]"
# Read from stdin
echo "Update [[cli#search]] to support filters" | lat prompt --stdin
# Example output:
# Please fix the bug in [[auth#OAuth Flow]]
#
#
# [auth#OAuth Flow](lat.md/auth.md:15-42): The OAuth 2.0 flow handles...
#
#
# Error case - ambiguous reference:
# Ambiguous reference [[search]].
# Could match:
# cli#search
# cli#search#Indexing
# cli#search#Vector Search
# Ask the user which section they meant.
```
--------------------------------
### Configure File Behavior with Frontmatter
Source: https://context7.com/1st1/lat.md/llms.txt
Use YAML frontmatter to enforce code-mention requirements for sections.
```markdown
---
lat:
require-code-mention: true
---
# Test Specifications
## Authentication Tests
### Rejects expired tokens
Tokens past their expiry timestamp must be rejected with HTTP 401,
even if the signature and payload are otherwise valid.
### Handles concurrent sessions
Multiple active sessions for the same user should be supported,
with each session having independent expiry times.
## API Rate Limiting
### Enforces per-user limits
Each authenticated user is limited to 100 requests per minute.
Exceeding this returns HTTP 429 with retry-after header.
```
--------------------------------
### Agent selection menu
Source: https://github.com/1st1/lat.md/blob/main/lat.md/cli.md
An interactive checklist menu is used for agent selection. Use up/down (j/k) to move, Space to toggle, and Enter to confirm. Non-TTY environments default to an empty selection.
```typescript
checklistMenu()
```
--------------------------------
### Command style selection
Source: https://github.com/1st1/lat.md/blob/main/lat.md/cli.md
Choose how agents should run lat commands: globally, locally, or via npx. This choice affects generated configuration files and portability.
```bash
lat
```
```bash
npx lat.md@latest
```
--------------------------------
### Version stamp and file hashes
Source: https://github.com/1st1/lat.md/blob/main/lat.md/cli.md
Stores INIT_VERSION and SHA-256 hashes in lat.md/.cache/lat_init.json. Used to detect and manage template file modifications.
```json
lat.md/.cache/lat_init.json
```
--------------------------------
### Markdown Syntax - Frontmatter Configuration
Source: https://context7.com/1st1/lat.md/llms.txt
Explains the use of YAML frontmatter for file-specific configurations, such as enforcing code mentions.
```APIDOC
## Markdown Syntax - Frontmatter Configuration
### Description
Use YAML frontmatter to configure per-file behavior. The `require-code-mention` option enforces that every leaf section has a corresponding `@lat:` reference in code.
### Method
N/A (Markdown Syntax)
### Endpoint
N/A
### Parameters
N/A
### Request Example
```markdown
---
lat:
require-code-mention: true
---
# Test Specifications
## Authentication Tests
### Rejects expired tokens
Tokens past their expiry timestamp must be rejected with HTTP 401,
even if the signature and payload are otherwise valid.
### Handles concurrent sessions
Multiple active sessions for the same user should be supported,
with each session having independent expiry times.
## API Rate Limiting
### Enforces per-user limits
Each authenticated user is limited to 100 requests per minute.
Exceeding this returns HTTP 429 with retry-after header.
```
### Response
N/A
```
--------------------------------
### lat.md CLI Commands
Source: https://github.com/1st1/lat.md/blob/main/AGENTS.md
Common commands for interacting with the lat.md knowledge graph. Use `lat --help` for a full list of options.
```bash
lat locate "Section Name" # find a section by name (exact, fuzzy)
lat refs "file#Section" # find what references a section
lat search "natural language" # semantic search across all sections
lat expand "user prompt text" # expand [[refs]] to resolved locations
lat check # validate all links and code refs
```
--------------------------------
### lat.md CLI Commands
Source: https://github.com/1st1/lat.md/blob/main/templates/AGENTS.md
Common commands for interacting with the lat.md knowledge graph. Use `lat --help` for a full list.
```bash
lat locate "Section Name"
```
```bash
lat refs "file#Section"
```
```bash
lat search "natural language"
```
```bash
lat expand "user prompt text"
```
```bash
lat check
```
--------------------------------
### lat gen - Generate Agent Instructions
Source: https://context7.com/1st1/lat.md/llms.txt
Generates template files to stdout, such as AGENTS.md, with instructions for AI coding agents on how to use lat.md.
```APIDOC
## lat gen - Generate Agent Instructions
### Description
Generates template files to stdout, such as `AGENTS.md` with instructions for AI coding agents on how to use lat.md.
### Method
CLI Command
### Endpoint
N/A
### Parameters
#### Path Parameters
- **template_file** (string) - Required - The name of the template file to generate (e.g., `agents.md`, `claude.md`).
### Request Example
```bash
# Generate AGENTS.md template
lat gen agents.md > AGENTS.md
# Or use the alias
lat gen claude.md > CLAUDE.md
```
### Response
#### Success Response (stdout)
- **content** (string) - The generated template content.
### Response Example
```markdown
# Before starting work
- Run `lat search` to find sections relevant to your task...
- Run `lat prompt` on user prompts to expand any `[[refs]]`...
# Post-task checklist (REQUIRED — do not skip)
...
```
```
--------------------------------
### Markdown Syntax - Wiki Links
Source: https://context7.com/1st1/lat.md/llms.txt
Explains the usage of Obsidian-style wiki links for cross-referencing between sections within markdown files.
```APIDOC
## Markdown Syntax - Wiki Links
### Description
Wiki links use Obsidian-style syntax to cross-reference between sections. The target is a section ID in the format `file-stem#Heading#SubHeading`.
### Method
N/A (Markdown Syntax)
### Endpoint
N/A
### Parameters
N/A
### Request Example
```markdown
See [[cli#search]] for semantic search documentation.
The [[parser#Wiki Links|link syntax]] is Obsidian-compatible.
Refer to [[cli#search#Indexing]] for how sections are indexed.
# Architecture
## Request Pipeline
Incoming requests flow through [[auth#Middleware]] before reaching handlers.
The response is formatted according to [[api#Response Format]].
```
### Response
N/A
```
--------------------------------
### Turso libsql Vector Search Query
Source: https://github.com/1st1/lat.md/blob/main/lat.md/cli.md
Illustrates a vector KNN query using Turso's libsql client. This query joins the results with the sections table to retrieve relevant sections based on vector similarity.
```sql
SELECT
sections.id,
sections.title,
sections.content,
sections.content_hash,
vector_top_k(sections.embedding, ?, ?, ?)
FROM sections
ORDER BY sections.embedding <-> ?
LIMIT ?;
```
--------------------------------
### lat.md directory scaffolding
Source: https://github.com/1st1/lat.md/blob/main/lat.md/cli.md
If the lat.md directory does not exist, it will be created. This process scaffolds essential files like .gitignore and README.md from templates.
```bash
lat.md/
```
--------------------------------
### Perform Semantic Search
Source: https://context7.com/1st1/lat.md/llms.txt
Executes vector-based semantic search across documentation. Requires the LAT_LLM_KEY environment variable.
```bash
# Set API key (OpenAI or Vercel)
export LAT_LLM_KEY="sk-..." # OpenAI
export LAT_LLM_KEY="vck_..." # Vercel AI Gateway
# Search for relevant sections
lat search "how does authentication work?"
# Limit results
lat search "error handling" --limit=3
# Force re-index all sections
lat search --reindex
# Example output:
# Indexed 2 new, 0 updated, 0 removed (18 unchanged)
#
# Results for "how does authentication work?":
#
# 1. auth#OAuth Flow
# Defined in lat.md/auth.md:15-42
# > The OAuth 2.0 flow handles user authentication via...
#
# 2. auth#Session Management
# Defined in lat.md/auth.md:44-67
# > Sessions are stored in Redis with a 24-hour TTL...
```
--------------------------------
### Wiki Link Syntax
Source: https://context7.com/1st1/lat.md/llms.txt
Obsidian-style syntax for cross-referencing sections within markdown files.
```markdown
See [[cli#search]] for semantic search documentation.
The [[parser#Wiki Links|link syntax]] is Obsidian-compatible.
Refer to [[cli#search#Indexing]] for how sections are indexed.
# Architecture
## Request Pipeline
Incoming requests flow through [[auth#Middleware]] before reaching handlers.
The response is formatted according to [[api#Response Format]].
```
--------------------------------
### Validate Links and Code References
Source: https://context7.com/1st1/lat.md/llms.txt
Ensures all wiki links resolve and @lat: code comments point to valid documentation sections.
```bash
# Run all validations
lat check
# Only validate wiki links in markdown files
lat check md
# Only validate code references
lat check code-refs
# Example output:
# Scanned 6 .md, 42 .ts, 3 .py
# lat.md/cli.md:14: broken link [[nonexistent#Section]] — no matching section found
# 1 error found
# Or on success:
# Scanned 6 .md, 42 .ts
# All checks passed
```
--------------------------------
### OpenAI Embeddings Endpoint
Source: https://github.com/1st1/lat.md/blob/main/lat.md/cli.md
Demonstrates direct fetch calls to an OpenAI-compatible /v1/embeddings endpoint for generating text embeddings. This approach minimizes dependencies by avoiding frameworks like LangChain.
```javascript
fetch(providerUrl, {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${llmKey}`,
},
body: JSON.stringify({
model: "text-embedding-3-small",
input: texts,
}),
});
```
--------------------------------
### Markdown Syntax - Code References with @lat
Source: https://context7.com/1st1/lat.md/llms.txt
Demonstrates how to anchor source code to documentation sections using `@lat:` comments in TypeScript and Python.
```APIDOC
## Markdown Syntax - Code References with @lat
### Description
Anchor source code to documentation sections using `@lat:` comments. Use `//` for JavaScript/TypeScript and `#` for Python.
### Method
N/A (Markdown Syntax)
### Endpoint
N/A
### Parameters
N/A
### Request Example
```typescript
// src/auth.ts
// @lat: [[auth#OAuth Flow]]
export async function handleOAuthCallback(code: string): Promise {
const tokens = await exchangeCodeForTokens(code);
const user = await fetchUserProfile(tokens.accessToken);
return createSession(user);
}
// @lat: [[auth#Token Validation]]
export function validateToken(token: string): boolean {
try {
const decoded = jwt.verify(token, process.env.JWT_SECRET);
return !isExpired(decoded);
} catch {
return false;
}
}
```
```python
# tests/test_auth.py
# @lat: [[tests#User login#Rejects expired tokens]]
def test_rejects_expired_tokens():
expired_token = create_token(expires_at=datetime(2020, 1, 1))
response = client.get("/api/user", headers={"Authorization": f"Bearer {expired_token}"})
assert response.status_code == 401
# @lat: [[tests#User login#Handles missing password]]
def test_handles_missing_password():
response = client.post("/api/login", json={"email": "test@example.com"})
assert response.status_code == 400
assert "password" in response.json()["error"]
```
### Response
N/A
```
--------------------------------
### Find References to a Section
Source: https://context7.com/1st1/lat.md/llms.txt
Identifies all locations, including markdown files and code comments, that reference a specific section.
```bash
# Find markdown files that link to a section
lat refs "parser#Wiki Links"
# Find code files with @lat: references
lat refs "auth#OAuth Flow" --scope=code
# Search both markdown and code
lat refs "tests#User login" --scope=md+code
# Example output:
# References to "parser#Wiki Links":
#
# 1. cli#check#md
# Defined in lat.md/cli.md:41-45
# > Validate that all [[parser#Wiki Links]] in lat.md markdown files...
#
# 2. markdown#Wiki Links
# Defined in lat.md/markdown.md:3-9
# > Obsidian-style links: [[target]] or [[target|alias]]...
```
--------------------------------
### Index Sections into Vector Database
Source: https://context7.com/1st1/lat.md/llms.txt
Builds or updates a vector index in a libsql database. Uses content hashing to re-embed only changed sections. Requires database initialization and provider detection.
```typescript
import { createClient } from '@libsql/client';
import { indexSections, type IndexStats } from 'lat.md/search/index';
import { detectProvider } from 'lat.md/search/provider';
import { initDb } from 'lat.md/search/db';
const db = createClient({ url: 'file:lat.md/.cache/vectors.db' });
await initDb(db);
const key = process.env.LAT_LLM_KEY!;
const provider = detectProvider(key);
const stats: IndexStats = await indexSections('./lat.md', db, provider, key);
console.log(`Added: ${stats.added}`);
console.log(`Updated: ${stats.updated}`);
console.log(`Removed: ${stats.removed}`);
console.log(`Unchanged: ${stats.unchanged}`);
// Example output:
// Added: 5
// Updated: 2
// Removed: 1
// Unchanged: 18
```
--------------------------------
### Test Specification Documentation
Source: https://github.com/1st1/lat.md/blob/main/templates/skill/SKILL.md
Defining test specs in markdown and linking them to test code implementations.
```markdown
---
lat:
require-code-mention: true
---
# Tests
Authentication test specifications.
## User login
Verify credential validation and error handling.
### Rejects expired tokens
Tokens past their expiry timestamp are rejected with 401, even if otherwise valid.
### Handles missing password
Login request without a password field returns 400 with a descriptive error.
```
```python
# @lat: [[tests#User login#Rejects expired tokens]]
def test_rejects_expired_tokens():
...
```
--------------------------------
### Find Sections by Query
Source: https://context7.com/1st1/lat.md/llms.txt
Searches sections using exact, subsection, or fuzzy matching. Requires loading all sections first.
```typescript
import { loadAllSections, findSections, flattenSections } from 'lat.md/lattice';
const latticeDir = './lat.md';
const allSections = await loadAllSections(latticeDir);
// Exact match by full path
const exactResults = findSections(allSections, 'cli#search#Indexing');
// Returns: [{ id: 'cli#search#Indexing', ... }]
// Subsection match by trailing segment
const subsectionResults = findSections(allSections, 'Indexing');
// Returns: [{ id: 'cli#search#Indexing', ... }]
// Fuzzy match handles typos (Levenshtein distance ≤ 40%)
const fuzzyResults = findSections(allSections, 'Indxeing');
// Returns: [{ id: 'cli#search#Indexing', distance: 2, ... }]
// Get all sections as a flat list
const flat = flattenSections(allSections);
console.log(`Total sections: ${flat.length}`);
```
--------------------------------
### Anchor Code to Documentation
Source: https://context7.com/1st1/lat.md/llms.txt
Use @lat: comments to link source code directly to documentation sections.
```typescript
// src/auth.ts
// @lat: [[auth#OAuth Flow]]
export async function handleOAuthCallback(code: string): Promise {
const tokens = await exchangeCodeForTokens(code);
const user = await fetchUserProfile(tokens.accessToken);
return createSession(user);
}
// @lat: [[auth#Token Validation]]
export function validateToken(token: string): boolean {
try {
const decoded = jwt.verify(token, process.env.JWT_SECRET);
return !isExpired(decoded);
} catch {
return false;
}
}
```
```python
# tests/test_auth.py
# @lat: [[tests#User login#Rejects expired tokens]]
def test_rejects_expired_tokens():
expired_token = create_token(expires_at=datetime(2020, 1, 1))
response = client.get("/api/user", headers={"Authorization": f"Bearer {expired_token}"})
assert response.status_code == 401
# @lat: [[tests#User login#Handles missing password]]
def test_handles_missing_password():
response = client.post("/api/login", json={"email": "test@example.com"})
assert response.status_code == 400
assert "password" in response.json()["error"]
```
--------------------------------
### YAML Frontmatter Configuration
Source: https://github.com/1st1/lat.md/blob/main/templates/skill/SKILL.md
Optional frontmatter used to enforce code mentions for test specifications.
```yaml
---
lat:
require-code-mention: true
---
```
--------------------------------
### lat.md ASCII logo and version check
Source: https://github.com/1st1/lat.md/blob/main/lat.md/cli.md
Displays the lat.md ASCII logo and checks for the latest version. Updates are announced if a newer version is available.
```bash
lat.md
```
--------------------------------
### scanCodeRefs - Scan Source Files for @lat Comments
Source: https://context7.com/1st1/lat.md/llms.txt
Walks project files (respecting .gitignore) and extracts all @lat: code references.
```APIDOC
## scanCodeRefs
### Description
Walks project files (respecting .gitignore) and extracts all @lat: code references.
### Parameters
- **projectRoot** (string) - Required - The root directory to scan.
```
--------------------------------
### findSections - Search Sections by Query
Source: https://context7.com/1st1/lat.md/llms.txt
Searches for sections matching a query using exact match, subsection match, and fuzzy matching strategies.
```APIDOC
## findSections
### Description
Searches for sections matching a query using exact match, subsection match, and fuzzy matching strategies.
### Parameters
- **allSections** (Array) - Required - The collection of sections to search.
- **query** (string) - Required - The search string (e.g., full path, trailing segment, or fuzzy term).
```
--------------------------------
### extractRefs - Extract Wiki Link References
Source: https://context7.com/1st1/lat.md/llms.txt
Extracts all wiki link references from a markdown file with their source location and enclosing section.
```APIDOC
## extractRefs
### Description
Extracts all wiki link references from a markdown file with their source location and enclosing section.
### Parameters
- **filePath** (string) - Required - Path to the markdown file.
- **content** (string) - Required - The file content to parse.
```
--------------------------------
### Code References with @lat
Source: https://github.com/1st1/lat.md/blob/main/templates/skill/SKILL.md
Annotating source code to link it back to specific documentation sections.
```typescript
// @lat: [[cli#init]]
export function init() { ... }
```
```python
# @lat: [[cli#init]]
def init():
...
```