feat(tasks): phase 1 — elevate chat session to a task (schema + task entity)

Migration 018 adds goal/status/outcome/summary/entity_id to agent_sessions
and creates session_plan_steps + session_questions. Registers a 'task'
entity type and an 'involves' (task→entity) relationship in the ontology
so each session anchors its knowledge and involved-entity edges on the
existing relationships graph.

nomos createSession now mints a task:<session-id> entity (type task) and
links it via agent_sessions.entity_id — best-effort so chat never blocks on
it. listSessions/GET /sessions surface the new task fields.

No behaviour change yet; this is the data foundation for the task board and
live context panel. Verified end-to-end against the local stack: migration
applied, ontology ingested (60 types/47 rels), a new session mints a linked
task entity and the API returns status/goal/entity_id.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-11 12:25:28 +02:00
parent eed6e3b1c5
commit 72e9fe534e
3 changed files with 116 additions and 4 deletions

View File

@@ -641,6 +641,14 @@ entity_types:
domain: cognition
layer: cognition
description: Recorded investigation/postmortem.
task:
parent: entity
domain: cognition
layer: cognition
description: A goal-structured unit of agent work — one chat/session elevated
to a task with a plan, lifecycle status, and outcome. Anchors the knowledge
and involved-entity relationships for the task so future tasks can learn
from it. Typed rows in agent_sessions.
# ─── Relationship types ────────────────────────────────────────────────
# cardinality is source→target: e.g. `hosts` one-to-many = one machine
@@ -928,6 +936,14 @@ relationship_types:
target: entity
cardinality: many-to-one
description: Document describes an entity.
involves:
inverse: involved-in
source: task
target: entity
cardinality: many-to-many
description: Task explored or acted on an entity (captured from its tool
calls). A task's involved-entity set is its graph neighborhood, so future
tasks on the same entities can surface this task's knowledge and outcome.
procedure-for:
inverse: has-procedure
source: runbook