Persistent memory shared by every Foundry project and agent. It stores entries (facts, decisions, lessons, procedures, errors), links between entries, and per-project session progress. You use it only through the PowerShell commands below. Never write SQL or touch the tables directly.
| Where you are | Command |
|---|---|
| In a generated project | . ./tools/knowledge.ps1 (finds the Foundry via FOUNDRY_HOME, else the path recorded in project.json; sets the project key) |
| In the Foundry repository | Import-Module ./powershell/Foundry.Knowledge/Foundry.Knowledge.psd1 |
Then check it works: Test-FoundryKnowledge. If Ready is false, read the failing check: usually
pwsh -File scripts/Start-Foundry.ps1 (in the Foundry) starts it. If EmbeddingsReady is false,
storing still works and search is keyword-only; say so. If the system cannot be started, tell the
user and carry on without it. Do not invent knowledge to compensate.
Add -AsJson to any command for compact JSON output.
Resume-FoundrySession (project's last session: objective, summary, next action, state).Search-FoundryKnowledge -Query "<what you are about to do>" -MaxTokens 3000 -IncludeRelated -AsJson
-VerifiedOnly when you are about to rely on a fact.Get-FoundryKnowledge -Id <id> for the full text of a result whose truncated is true and which matters.Get-FoundryRelationships -Id <id> -Depth 2 to follow links (for example a problem to its solution).Start-FoundrySession -Agent "<your name>" -Objective "<task>" so progress can be resumed.Retrieve only what the current task needs. Do not dump the knowledge base into your context.
Record what a future session would be glad to find, once it is verified or clearly labelled:
Add-FoundryKnowledge -Title "<one-line claim>" -Content "<detail>" -Type technical-fact `
-Source "<evidence: test, command and result, spec section, documentation>" -Status verified -Confidence 0.9
Add-FoundryLesson -Title "..." -Lesson "..." -Source "..."
Add-FoundryDecision -Title "..." -Decision "..." -Rationale "..." -Alternatives "..."
Add-FoundryRelationship -SourceId <id> -TargetId <id> -Type SOLVES # RELATED_TO, DEPENDS_ON, CAUSES, ...
Update-FoundryKnowledge -Id <old> -SupersededBy <new> # replace outdated knowledge
Save-FoundrySession -Summary "..." -NextAction "..." -State @{ ... } [-Complete]
Types: technical-fact, lesson-learned, decision, procedure, error-solution,
project-memory, preference, episode.
-Status verified requires a -Source that is real evidence you
obtained this session or that is cited documentation. Everything else stays unverified
(the default). Never mark something verified because it sounds right.-Global. Use -Global only
for knowledge that holds for any project (hardware facts, tool behavior). Project decisions,
constraints and progress stay project-scoped.AGENTS.md, the approved spec, passing tests or what the user tells you now. If stored
knowledge contradicts the code or the spec, trust the code and spec, then correct the entry.Update-FoundryKnowledge it, or supersede it.similarity is cosine similarity (1 = identical meaning);
low values are weak matches.pwsh -File scripts/Backup-Knowledge.ps1 (Foundry only).Powered by TurnKey Linux.