Contents Menu Expand Light mode Dark mode Auto light/dark, in light mode Auto light/dark, in dark mode Skip to content
luplo
luplo
  • Quickstart
  • Concepts
    • Philosophy
    • Positioning
    • Architecture
    • Data model
    • Search pipeline
  • Guides
    • Work units
    • Tasks and QA checks
    • Connecting an MCP client
    • Running the Remote server
    • Running the Local worker
  • Reference
    • CLI reference
    • MCP tool reference
    • Configuration reference
    • Rule pack (lp check)
    • Semantic impact categories
  • Project
    • Roadmap
    • Contributing
    • Changelog
    • License
  • API reference
    • luplo
      • luplo.cli
      • luplo.config
      • luplo.core
        • luplo.core.actors
        • luplo.core.audit
        • luplo.core.backend
          • luplo.core.backend.local
          • luplo.core.backend.protocol
          • luplo.core.backend.remote
        • luplo.core.captures
        • luplo.core.checks
          • luplo.core.checks.registry
          • luplo.core.checks.rules
            • luplo.core.checks.rules.dangling_edge
            • luplo.core.checks.rules.missing_rationale
            • luplo.core.checks.rules.undated_retention
            • luplo.core.checks.rules.unlinked_policy
            • luplo.core.checks.rules.unresolved_conflict
          • luplo.core.checks.runner
          • luplo.core.checks.types
        • luplo.core.db
        • luplo.core.embedding
          • luplo.core.embedding.local
          • luplo.core.embedding.null
          • luplo.core.embedding.protocol
        • luplo.core.errors
        • luplo.core.extract
          • luplo.core.extract.pipeline
        • luplo.core.glossary
        • luplo.core.history
        • luplo.core.id_resolve
        • luplo.core.ideas
        • luplo.core.impact
        • luplo.core.import_pipeline
          • luplo.core.import_pipeline.begin
          • luplo.core.import_pipeline.codeblock_strip
          • luplo.core.import_pipeline.finalize
          • luplo.core.import_pipeline.manifest
          • luplo.core.import_pipeline.refusal
          • luplo.core.import_pipeline.results
          • luplo.core.import_pipeline.sources
        • luplo.core.item_types
        • luplo.core.items
        • luplo.core.links
        • luplo.core.models
        • luplo.core.projects
        • luplo.core.qa
        • luplo.core.schemas
        • luplo.core.search
          • luplo.core.search.pipeline
          • luplo.core.search.tsquery
        • luplo.core.sync
          • luplo.core.sync.queue
        • luplo.core.systems
        • luplo.core.tasks
        • luplo.core.timeparse
        • luplo.core.work_units
        • luplo.core.worker
      • luplo.mcp
Back to top
View this page

luplo.core.links¶

CRUD operations for the links table.

Links are typed, weighted edges between items — e.g. excludes, synergizes_with, interacts_with. The link_type is free-form text (not an enum) so new relationship types can appear as systems grow.

Functions¶

create_link(→ luplo.core.models.Link)

Create a typed edge between two items.

get_links(→ list[luplo.core.models.Link])

Query links connected to an item.

delete_link(→ bool)

Delete a link by its composite primary key.

Module Contents¶

async luplo.core.links.create_link(conn: psycopg.AsyncConnection[Any], *, from_item_id: str, to_item_id: str, link_type: str, strength: int = 5, note: str | None = None, actor_id: str | None = None) → luplo.core.models.Link¶

Create a typed edge between two items.

Parameters:
  • conn – Async psycopg connection.

  • from_item_id – Source item.

  • to_item_id – Target item.

  • link_type – Relationship type (e.g. "excludes").

  • strength – Weight 1-10, default 5.

  • note – Optional annotation.

  • actor_id – Who created this link.

Returns:

The newly created Link.

Raises:

psycopg.errors.UniqueViolation – If the exact (from_item_id, to_item_id, link_type) triple already exists.

async luplo.core.links.get_links(conn: psycopg.AsyncConnection[Any], item_id: str, *, direction: str = 'from', link_type: str | None = None) → list[luplo.core.models.Link]¶

Query links connected to an item.

Parameters:
  • conn – Async psycopg connection.

  • item_id – The item to query links for.

  • direction – "from" (outgoing), "to" (incoming), or "both".

  • link_type – Optional filter by relationship type.

Returns:

List of matching Link objects ordered by created_at DESC.

async luplo.core.links.delete_link(conn: psycopg.AsyncConnection[Any], from_item_id: str, to_item_id: str, link_type: str) → bool¶

Delete a link by its composite primary key.

Returns:

True if the link existed and was deleted, False otherwise.

Next
luplo.core.models
Previous
luplo.core.items
Copyright © 2026, hanyul99
Made with Sphinx and @pradyunsg's Furo
On this page
  • luplo.core.links
    • Functions
    • Module Contents
      • create_link()
      • get_links()
      • delete_link()