Skip to content

PKM Link

Maintains the graph by adding, refining, or correcting relations between AnyType objects.

When to use

  • "Link X to Y" / "this person is part of project Z" / "this event was about idea Q".
  • Wiki lint finds orphan objects (no inbound or outbound relations).
  • Inbox entry promoted to a typed object — wire its relations.
  • Cross-linking a wiki page's AnyType object to related objects.

What you produce

  • Updated relations on existing AnyType objects.
  • Updated related: frontmatter in wiki pages where applicable.
  • Audit-log entries per write.

MCP tools used

  • mcp__anytype__API-search-space — find objects by name and type
  • mcp__anytype__API-get-object — read current property values before updating
  • mcp__anytype__API-update-object — write the new relation

Procedure

  1. Identify the two ends. Use mcp__anytype__API-search-space to locate objects by name + type.
  2. If multiple matches, ask the user to disambiguate.
  3. Note both object IDs before proceeding.
  4. Choose the relation property. Per schemas/object-types.md:
Relation Property key Format Directionality
Person → Person (manager) reports_to objects directed — set on the report, pointing at the manager. Do NOT mirror.
Person ↔ Person (peer) collaborates_with objects symmetric — set on both ends
Person ↔ Project (pkm_project) affiliations objects symmetric
Person ↔ Event participants objects symmetric
Idea ↔ Idea related_ideas objects symmetric
Idea ↔ Project (pkm_project) related_projects objects symmetric
Idea ↔ Source (Bookmark) provoked_by objects symmetric
Event ↔ Project (pkm_project) related_projects objects symmetric

⚠️ Custom Project type key is pkm_project, not project.

⚠️ reports_to is directed — do not mirror it. "A reports to B" sets reports_to=[...,B] on A only. Writing the reverse on B would corrupt the org-chart direction the graph export depends on (reports_to → directed WORKS_FOR edge A→B). collaborates_with is the symmetric peer relation and is written on both ends. See the graph-export semantics note in schemas/object-types.md.

⚠️ Page ↔ Page links cannot be set via API. AnyType's built-in links property is system-managed and read-only — setting it returns HTTP 400. Markdown body links are stored as text but do NOT populate the links graph property. For wiki cross-links between Page-type objects: update related: frontmatter in the markdown file and add a "Related" section in the object markdown body via update-object. The AnyType object graph will not reflect these until a user creates @ mentions in the UI.

  1. Read before write. Call mcp__anytype__API-get-object on the object being updated.
  2. Extract the current value of the target property (it may already have entries).
  3. ⚠️ update-object replaces property values, not appends. Always build the full new list: [...existing_ids, new_id].
  4. Write the link via mcp__anytype__API-update-object.
  5. Set the property to the full updated list of object IDs.
  6. Repeat for the other end if the relation should be bidirectional.
  7. Update wiki frontmatter (if either object has a corresponding wiki page):
  8. Add anytype:<object_id> to the related: list in the relevant markdown file if not already present.
  9. Audit log entry in audit-log.md. Action: link.
  10. If a Project gained a new linked Idea, check whether the link implies new acceptance_criteria. Ask the user before writing.

Anti-patterns

  • Don't guess which Person/Event/Idea matches — always disambiguate.
  • Don't create new objects in this skill — that's what pkm-capture is for.
  • Don't link across data classifications without verifying runtime policy compatibility.
  • Don't overwrite existing objects property values — read first, then write the merged list.
  • Don't mirror reports_to — it is directed (report → manager only). Mirroring inverts the org-chart edge.
  • Don't use type_key: project — use pkm_project.
  • Don't attempt to set the links property directly — it is reserved and will 400.

Compatibility

  • Requires AnyType Local API + MCP server configured.
  • Requires the agent-scoped key.
  • Local-only.