Skip to content

Define custom Graphiti entity types for coding session knowledge #244

Description

@geier

Context

Graphiti extracts entities and relationships from text using LLM-powered pipelines. By default, it uses generic entity types (Preference, Requirement, Procedure, Location, Event, Organization, Document, Topic, Object). For coding sessions, we need custom entity types that better capture the domain-specific knowledge we want to remember.

This ensures that the knowledge graph is structured in a way that makes retrieval useful for future coding sessions.

Goal

Define and configure custom Pydantic entity types in Graphiti that are optimized for coding session knowledge extraction.

Requirements

Entity Types to Define

Entity Type Description Example
Project A software project or repository "pk-opencode-webui", "graphiti"
Framework A framework or major library "SolidJS", "Express", "Tailwind CSS"
Library A package or dependency "zod", "drizzle-orm", "qdrant-client"
Architecture An architectural pattern or decision "MCP for tool integration", "SSE for real-time events"
CodePattern A coding pattern or convention "avoid let statements", "use Bun APIs"
ErrorSolution A problem and its resolution "CORS error fixed by adding proxy headers"
FileComponent A significant file or module "session.tsx", "serve-ui.ts"
DeploymentConfig A deployment or infrastructure detail "s6-overlay for process supervision", "port 4096 for API"
Preference A user or team preference "TypeScript over JavaScript", "single-word variable names"
Procedure A workflow or process "deploy with docker compose up", "run bun run dev for local dev"

Configuration

  • Define as Pydantic models compatible with Graphiti's entity type system
  • Include descriptions for each type that guide the LLM extraction
  • Configure which types are used for extraction vs. just categorization
  • Test with sample coding session transcripts to verify extraction quality

Extraction Tuning

  • Consider adding extraction prompt customization if Graphiti supports it
  • Ensure code snippets, file paths, and error messages are preserved in entity attributes
  • Verify temporal invalidation works correctly (e.g., "switched from Express to Hono" invalidates old Framework entity relationships)

Files to create/modify

  • memory/entity_types.py — custom Pydantic entity type definitions
  • memory/docker-compose.yml — reference entity types config in Graphiti service (if needed)
  • memory/README.md — document custom entity types and their purpose

Reference

  • Graphiti custom entity types: https://github.com/getzep/graphiti (check docs for EntityType Pydantic models)
  • Default entity types in Graphiti: Preference, Requirement, Procedure, Location, Event, Organization, Document, Topic, Object
  • Graphiti MCP server config.yaml may support entity type customization

Acceptance Criteria

  • Custom entity types are defined and loadable by Graphiti
  • A sample coding session transcript is ingested and produces meaningful entities of the custom types
  • Temporal invalidation works (e.g., framework changes are tracked correctly)
  • Entity types are documented with examples
  • Searching by entity type filters correctly (e.g., search_nodes with entity_types=["ErrorSolution"])

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority:mediumNormal priority (default)readyWell-scoped and ready for implementationtaskIndividual task issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions