Skip to content

pm_knowledge

Sovereign
Sovereign tier required. Workspace Knowledge is an advanced MCP surface because it lets agents attach local sources, index code, search persistent workspace context, and record durable memory.

The pm_knowledge tool turns Valdr’s Workspace Knowledge layer into an agent-callable surface. Agents can attach docs and code, queue ingestion, search across project and global context, record durable notes, and ask symbol-shaped questions such as “definition of HttpClientBuilder” or “callers of parseConfig”.

Use this tool when an agent needs more than the current prompt window. pm_knowledge lets teams keep canonical docs, operational runbooks, indexed source trees, Valdr records, and Agent Memory Notebooks available as structured retrieval instead of re-explaining the same context in every session.

Project-scoped sources must live inside one of the project’s repository roots. Global sources are for shared workspace context and are guarded against over-broad or sensitive filesystem paths.
Symbol-aware code intelligence currently supports TypeScript/TSX and Java. The search action can still retrieve indexed code chunks from other languages, but code_map symbol resolution, references, and graph traversal are only expected for TypeScript/TSX and Java sources right now.

Actions

get, update_sources, record_entry, ingest, search, code_map, status, help


Scope Model

Most read actions can target one project, several projects, global Workspace Knowledge, or everything.

ScopeUse for
projectOne project’s attached knowledge sources
projectsAn explicit set of project IDs
globalWorkspace-wide knowledge not owned by one project
allProject and global knowledge together

scope: "project" requires projectId. scope: "projects" requires projectIds. update_sources and record_entry write to either project or global because every attachment belongs to one scope.

Knowledge Sources

update_sources can attach these source shapes:

Knowledge typeResource kindTypical use
docsfolderProduct docs, architecture notes, runbooks
code_intelligencefolderSource trees for code search and code map

attachment:file, url:url, and code_intelligence:file are compatibility values for older persisted rows. They are not current public attach modes.

record_entry manages first-class records instead:

Entry typePurpose
agent_knowledgeAgent Memory Notebooks for durable per-agent notes
valdr_record_materializedMaterialized Valdr records such as task snapshots

Trust tiers influence ranking:

Trust tierTypical source
canonicalFirst-party docs, primary specs, official project guidance
operationalRunbooks, operator notes, project references
memoryAgent Memory Notebook entries, draft observations, lower-confidence context

get

List knowledge attachments and their underlying resources for a scope.

Parameters

FieldTypeRequiredNotes
scopestringYesproject, projects, global, or all
projectIdstringConditionalRequired when scope is project
projectIdsstring[]ConditionalRequired when scope is projects
includeDisabledbooleanNoInclude disabled attachments

Example

pm_knowledge {
  action: "get",
  scope: "project",
  projectId: "proj_checkout_01",
  includeDisabled: false
}

Returns attachment summaries, resource summaries, and stale/failed counts.

Project-scoped attachment summaries include projectKey alongside the stable scopeId. projectKey is only a readable convenience field; scopeId remains the canonical project identifier.


update_sources

Add, remove, enable, disable, or update source attachments for a project or global scope.

Parameters

FieldTypeRequiredNotes
scopestringYesproject or global
projectIdstringConditionalRequired when scope is project
operationsarrayYesOne or more source operations

Operations

OperationRequired fieldsNotes
addknowledgeType, resourceKind, locatorOptional label, trustTier, rankingWeight, enabled
removeattachmentIdDetaches the source from the scope
enableattachmentIdRe-enables retrieval from the attachment
disableattachmentIdKeeps the attachment but excludes it by default
updateattachmentId plus one mutable fieldCan update label, trustTier, rankingWeight, or enabled

Example

pm_knowledge {
  action: "update_sources",
  scope: "project",
  projectId: "proj_checkout_01",
  operations: [
    {
      op: "add",
      knowledgeType: "code_intelligence",
      resourceKind: "folder",
      locator: "file:///Users/me/dev/acme-checkout/services/checkout/src",
      label: "Checkout Service Source",
      trustTier: "operational"
    }
  ]
}

Source policy rejects sensitive paths, over-broad global folders, unsupported source shapes, and project-scoped paths outside the project’s repository roots.


record_entry

Create, update, delete, or append managed knowledge records that are written through record_entry instead of update_sources.

Parameters

FieldTypeRequiredNotes
modestringYescreate, update, delete, or append
entryTypestringYesagent_knowledge or valdr_record_materialized
scopestringYesproject or global
projectIdstringConditionalRequired when scope is project
entryIdstringConditionalRequired for update/delete
titlestringNoEntry or note title
bodystringNoEntry body
trustTierstringNoDefaults by entry type
rankingWeightnumberNo0.1 to 2.0
metadataobjectNoCaller-defined metadata

Agent Memory Notebooks

Use mode: "append" with entryType: "agent_knowledge" to add a note to one Agent Memory Notebook per agent per scope.

pm_knowledge {
  action: "record_entry",
  mode: "append",
  entryType: "agent_knowledge",
  scope: "project",
  projectId: "proj_checkout_01",
  agentHandle: "checkout-reviewer",
  title: "Reviewer memory",
  body: "Prefer the mock gateway contract when testing refunds."
}

Agent handles are normalized to lowercase. create and update are not valid for agent_knowledge; append adds memory, delete removes a notebook or a specific note.

Delete one note from a notebook:

pm_knowledge {
  action: "record_entry",
  mode: "delete",
  entryType: "agent_knowledge",
  scope: "project",
  projectId: "proj_checkout_01",
  entryId: "entry_checkout_reviewer_notes",
  noteId: "note_checkout_reviewer_002"
}

Materialized Valdr Records

Use valdr_record_materialized for structured snapshots of Valdr records.

pm_knowledge {
  action: "record_entry",
  mode: "create",
  entryType: "valdr_record_materialized",
  scope: "project",
  projectId: "proj_checkout_01",
  recordType: "task",
  recordId: "CHECKOUT-42",
  recordVersion: 1,
  title: "Refund retry acceptance snapshot",
  body: "Acceptance notes for retry behavior and alert routing.",
  trustTier: "canonical"
}

ingest

Queue resources for extraction, chunking, embedding, and code graph indexing.

Parameters

FieldTypeRequiredNotes
scopestringNoDefaults to all when no explicit IDs are provided
projectIdstringConditionalRequired when scope is project
attachmentIdsstring[]NoIngest exact attachments
resourceIdsstring[]NoIngest exact resources
modestringNoincremental default, or rebuild
executionstringNoinline default, or background

Selection precedence is attachmentIds, then resourceIds, then the resolved scope.

Example

pm_knowledge {
  action: "ingest",
  scope: "project",
  projectId: "proj_checkout_01",
  mode: "incremental",
  execution: "background"
}

incremental skips unchanged resources. rebuild re-extracts every chunk and refreshes derived indexes. background returns immediately while Valdr drains the ingest queue; inline waits for the run to finish.


search

Run filtered keyword or prose retrieval across indexed docs, records, notes, and code chunks.

Parameters

FieldTypeRequiredNotes
querystringYesSearch text
scopestringNoproject, projects, global, or all
projectId / projectIdsstring / string[]ConditionalRequired for project scopes
topKnumberNo1 to 50, default 10
offsetnumberNoPagination offset
retrievalModestringNoauto, lexical, semantic, or hybrid
knowledgeTypesstring[]NoFilter by source type
resourceKindsstring[]NoFilter by physical source shape
trustTiersstring[]NoFilter by trust tier
languagesstring[]NoFilter code chunks by language
symbolKindsstring[]NoFilter code chunks by symbol kind
pathPrefixesstring[]NoAccepts file://, absolute, or project-relative prefixes
exactTokenbooleanNoRequire whole-token matches
enabledOnlybooleanNoDefaults to true
includeContentbooleanNoInclude full chunk text in hits[].content
includeScoreBreakdownbooleanNoLegacy diagnostics switch; prefer responseProfile: "debug"
responseProfilestringNocompact, debug, or full; compact is the default

Example

pm_knowledge {
  action: "search",
  scope: "project",
  projectId: "proj_checkout_01",
  query: "refund retry escalation",
  retrievalMode: "hybrid",
  topK: 10,
  pathPrefixes: ["docs/runbooks"]
}

Compact search hits include excerpts, source ids, line ranges when available, scores, and optional full content. Use responseProfile: "debug" or "full" for ranking reasons, score breakdowns, and expanded attachment diagnostics. When semantic retrieval is unavailable, the response reports why in semanticUnavailableReasons.

Compact search responses keep hits small by hoisting attachment summaries into an attachments map. Project-scoped attachment summaries include projectKey; hits refer to them by effectiveAttachmentId or attachmentIds.


code_map

Run symbol-oriented graph navigation grouped by role. Use this when the query is about definitions, callers, references, imports, tests, or docs for a symbol.

Query Patterns

IntentPattern examples
Definitiondefinition of HttpClientBuilder, where is ConnectionPool defined
Referencesreferences to Future, where do we use RequestContext
Callerscallers of parseConfig, who calls normalizeRequest
Imports/exportsimports of HttpClientOptions, exports ConnectionPool
Teststests for CacheManager, where is retryPolicy tested
Docsdocs for deployment runbooks, documentation for release checklist

Plain prose falls back to retrieval grouping. Rephrase into one of the patterns above when graph navigation matters.

Parameters

FieldTypeRequiredNotes
querystringYesSymbol or graph-intent query
scopestringNoproject, projects, global, or all
projectId / projectIdsstring / string[]ConditionalRequired for project scopes
topKnumberNoOverall hit target
knowledgeTypesstring[]NoFilter source/result hits
resourceKindsstring[]NoFilter source/result hits
languagesstring[]NoFilter by chunk language
symbolKindsstring[]NoFilter source/result symbol kinds
pathPrefixesstring[]NoFilter returned hits by path
responseProfilestringNocompact default, debug, or full
includeDiagnosticsbooleanNoInfer debug when profile is omitted
includeContentbooleanNoInclude chunk content
includeRawRetrievalbooleanNoInclude raw flat retrieval payload
maxTotalHitsnumberNoCap grouped hits
maxHitsPerGroupnumberNoCap each role group

Example

pm_knowledge {
  action: "code_map",
  scope: "project",
  projectId: "proj_checkout_01",
  query: "definition of PaymentRetryPolicy",
  languages: ["ts"],
  pathPrefixes: ["services/checkout/src"],
  topK: 20,
  responseProfile: "compact"
}

The response groups hits into definitions, references, imports, exports, tests, docs, and related. It also reports whether persisted symbol and reference graphs were used, so agents can distinguish graph-backed answers from retrieval fallback.

code_map does not accept search-only controls such as retrievalMode, exactToken, offset, trustTiers, attachmentIds, or includeScoreBreakdown. Use search for those controls.

status

Fetch knowledge health counters for a scope. This is the quickest way to see whether sources have been ingested and whether code graph data exists.

Parameters

FieldTypeRequiredNotes
scopestringNoDefaults to all
projectId / projectIdsstring / string[]ConditionalRequired for project scopes
profilestringNosummary or full

Example

pm_knowledge {
  action: "status",
  scope: "project",
  projectId: "proj_checkout_01"
}

Returns counts for resources, attachments, entries, chunks, code chunks, docs chunks, symbols, references, stale resources, failed resources, indexed languages, and the active embedding model.


help

Return the canonical help payload from the MCP server.

pm_knowledge { action: "help" }

Use this when building an agent capability around Workspace Knowledge. The help payload includes actions, query patterns, examples, cautions, and the docs path emitted by the running server.

Error Codes

Common knowledge errors:

CodeMeaning
KNOWLEDGE_INVALID_LOCATORLocator was not valid or could not be inspected
KNOWLEDGE_PROJECT_REQUIREDProject scope was missing a project ID
KNOWLEDGE_SOURCE_OUTSIDE_PROJECTProject source was outside the project’s repo roots
KNOWLEDGE_SOURCE_TOO_BROADGlobal folder pointed at a system root or broad home/tmp path
KNOWLEDGE_SOURCE_TOO_LARGEFolder exceeded the source file limit
KNOWLEDGE_SENSITIVE_SOURCESource matched a sensitive path or credential filename
KNOWLEDGE_UNSUPPORTED_SOURCE_TYPEResource kind/type is not supported by the ingest path
KNOWLEDGE_RESOURCE_NOT_FOUNDTargeted resource ID does not exist
KNOWLEDGE_ATTACHMENT_NOT_FOUNDTargeted attachment ID does not exist
KNOWLEDGE_INGEST_TARGET_REQUIREDIngest had no resolvable target
KNOWLEDGE_RECORD_ENTRY_MODE_REQUIREDrecord_entry was missing mode
KNOWLEDGE_UNKNOWN_ACTIONUnknown action name

Related

  • Workspace Knowledge feature guide - product-level overview of workspace context, search, code map, and Agent Memory Notebooks workflow
  • pm_project - projects provide the repo roots used by project-scoped knowledge
  • pm_task - tasks can be materialized into durable knowledge records
  • pm_agent - agents can record and later retrieve scoped notebook memory
  • pm_health - verify the running MCP server and available tool inventory