---
name: fem-theory-query
description: Use when answering finite element method, structural analysis solver, element formulation, residual/tangent, constitutive integration, contact, dynamics, eigenproblem, or verification questions from a configured FEM wiki vault.
---

# FEM Theory Query

Use this skill as a portable domain router for finite element method and structural solver theory questions. Ground answers in a configured FEM wiki vault, then compose sibling skills instead of reimplementing their workflows.

## FEM Vault Resolution

Resolve the FEM wiki vault in this order:

1. Skill-local config file: `vault-path.txt` in this skill folder. Read the first non-empty, non-comment line as the vault root path.
2. Current project instructions: `AGENTS.md`, `CLAUDE.md`, or an equivalent section named `FEM Solver Theory Wiki`.
3. Environment variable: `FEM_THEORY_WIKI_VAULT`.

If no valid vault is found, ask the user for the vault path. A valid vault must contain `wiki/hot.md` or `wiki/index.md`.

Keep `vault-path.txt` PC-specific. When the vault moves, update that file instead of editing this skill body.

## Companion Skill Protocols

This skill is an orchestrator. Do not reimplement sibling skills. Use the sibling skill instructions as authoritative when available.

### Companion skill path resolution

After reading `vault-path.txt`, call that value `FEM_VAULT_ROOT`. Resolve companion skill files from that absolute vault root:

- `FEM_VAULT_ROOT\skills\think\SKILL.md`: use for non-trivial FEM formulation, solver architecture, ambiguity, tradeoffs, verification design, or gap assessment.
- `FEM_VAULT_ROOT\skills\wiki-query\SKILL.md`: use for normal wiki-grounded answers from the configured FEM vault.
- `FEM_VAULT_ROOT\skills\autoresearch\SKILL.md`: use only when the user explicitly asks to research, find sources, update the wiki, or fill missing wiki coverage.

If the runtime provides a skill activation mechanism, activate the companion skill by name. If not, read the absolute companion `SKILL.md` path constructed from `vault-path.txt` and follow its workflow. If an absolute companion path does not exist, tell the user which path is missing and ask them to fix `vault-path.txt`.

### Relative paths inside companion skills

When a companion skill refers to another file by a relative path, resolve that path from the absolute directory of the companion skill file under `FEM_VAULT_ROOT`, not from the caller project or current working directory. Normalize `..` segments after joining paths. Keep the resolved path inside `FEM_VAULT_ROOT` unless the companion skill explicitly requires an external path.

Examples from `FEM_VAULT_ROOT\skills\autoresearch\SKILL.md`:

- `../wiki-cli/SKILL.md` resolves to `FEM_VAULT_ROOT\skills\wiki-cli\SKILL.md`.
- `../../wiki/references/transport-fallback.md` resolves to `FEM_VAULT_ROOT\wiki\references\transport-fallback.md`.
- `references/program.md` resolves to `FEM_VAULT_ROOT\skills\autoresearch\references\program.md`.

If a resolved companion-relative path is missing, report the missing absolute path and ask the user to fix `vault-path.txt` or install the full `skills/` bundle.

### How to use `think`

Use `think` as a compact internal preflight before answering FEM solver questions.

Do:
- Identify the user's real question: theory derivation, implementation design, verification, comparison, or missing source.
- Check whether you are relying on memory instead of wiki evidence.
- Decide whether the answer can be handled by wiki query or needs autoresearch.
- For complex questions, surface the reasoning structure briefly in the answer.

Do not:
- Print all 10 stages for routine factual questions.
- Use `think` as a substitute for reading wiki sources.
- Skip the `ACCEPT` step when the wiki has insufficient coverage.

### How to use `wiki-query`

Use `wiki-query` for the default answer path.

Follow this order:

1. Resolve the FEM vault path.
2. Read `wiki/hot.md`.
3. If needed, use `wiki-retrieve` when provisioned: `python scripts/retrieve.py "<question>" --top 5`.
4. If retrieval is not provisioned or fails, read `wiki/index.md`.
5. Read 3-7 relevant wiki pages.
6. Synthesize with Obsidian wikilink citations.

Do:
- Cite every core claim with `[[Page Name]]`.
- Prefer vault evidence over model memory.
- Say clearly when the wiki lacks enough evidence.

Do not:
- Answer a vault-specific question from training data alone.
- Open many pages when 3-7 are enough.
- Write to the wiki unless the user explicitly asks.

### How to use `autoresearch`

Use `autoresearch` only for explicit research or wiki-expansion requests.

Trigger examples:
- "Find sources and strengthen this wiki coverage."
- "If the wiki does not cover this, research it."
- "Research and file this topic."
- "Create source and concept pages for this topic."

Before starting:
- Tell the user it will use web search/fetch and write new wiki pages.
- Mention that fetched content is subject to the `autoresearch` web egress hygiene rules.
- Ask for approval unless the user already gave explicit approval in the same request.

Do:
- Read `FEM_VAULT_ROOT\skills\autoresearch\SKILL.md` and `FEM_VAULT_ROOT\skills\autoresearch\references\program.md`.
- File results into the configured FEM vault, not the caller project.
- Use wiki locks and transport rules from the sibling skill.

Do not:
- Run autoresearch for ordinary Q&A.
- Fetch web sources silently.
- Write into `.raw/` or `wiki/` without explicit user intent.

## Answer Contract

Answer in the user's language. For Korean questions, translate the section headings naturally.

Use this structure unless the user asks for another format:

- Summary conclusion
- Formulation
- Solver implementation view
- Verification and benchmarks
- Evidence
- Wiki gap

Every core technical claim should trace to wiki evidence. Use Obsidian wikilinks such as `[[Finite Element Method]]`, `[[Solid Element Stiffness Integration]]`, or the relevant source page. If the wiki does not cover a point, label it as a gap instead of presenting model memory as vault knowledge.

## FEM Query Expansion

When a user asks a short FEM question, expand the retrieval intent before searching:

- Element formulation: shape functions, DOFs, Jacobian, `B` matrix, integration, load vector, result recovery.
- Nonlinear solve: residual, tangent, Newton update, convergence norms, load/time increments, cutback policy.
- Constitutive update: stress update, material tangent, state variables, return mapping, history evolution.
- Dynamics/eigen: mass, damping, time integration, modal extraction, normalization, residual checks.
- Contact/constraints: gap, normal/tangential law, penalty or multiplier enforcement, search, tangent contribution.
- Verification: patch tests, convergence, benchmark problems, matrix checks, residual norms, source-solver comparison.

Keep expansion internal unless showing it helps the user understand the answer.

## Deployment Notes

Distribute this skill with the whole `skills/` bundle so sibling paths remain valid. After installing or symlinking the bundle into another agent, update `vault-path.txt` for that PC or set `FEM_THEORY_WIKI_VAULT`.
