Skip to content

feat: room document view — structured document generation from room memories #306

Closed

Description

@ajianaz

Problem

Rooms are currently flat collections of linked memories — essentially a shared inbox with attribution. There is no document structure within a room.

A "room" in #286 was designed as "Room 123: Document-based / Meeting" (from the Excalidraw diagram). But the current implementation falls short of this vision:

Expectation (design) Reality (implementation)
Document with sections, headings, narrative flow Flat list of memories sorted by time
Agent can write a structured document collaboratively Agents dump individual memories into a shared space
Room has a coherent "story" or "document" Room is a bag of independent memory fragments
Room can be exported as a readable document Room can only dump individual memories

This matters because rooms are meant to be the shared context space for multi-agent discussions. A discussion has structure: agenda, topics, decisions, action items, conclusions. A flat memory list cannot represent this structure.

Current behavior

uteke room recall project-kickoff
# → 1. "We should use PostgreSQL" (author: cto, memory_type: decision)
# → 2. "Searched benchmarks for pgvector" (author: kai, memory_type: fact)
# → 3. "Let's discuss auth next" (author: cto, memory_type: context)
# → 4. "JWT seems best" (author: zeko, memory_type: decision)
# → ... 47 more memories in flat list

Expected behavior

uteke room document project-kickoff
# → Structured document:
# 
# # Project Kickoff Meeting Notes
# ## Decisions
# - Database: PostgreSQL with pgvector (cto)
# - Auth: JWT + refresh tokens (zeko)
# ## Research Findings
# - pgvector benchmarks show 85th percentile latency <5ms (kai)
# ## Open Questions
# - GraphQL vs REST for v2 API (undecided)
# ## Action Items
# - cto: set up PostgreSQL instance
# - kai: write migration script

Why This Matters

1. Rooms should produce documents, not data dumps

The whole point of multi-agent discussion is to produce shared understanding — a document that captures what was discussed, decided, and actioned. Without document structure, rooms are just a more complex version of individual memory stores.

When an agent shares a room's content with a human (e.g., via Discord message, email, or report), they currently have to manually synthesize 50+ flat memories into a coherent narrative. This defeats the purpose of rooms as collaboration spaces.

2. Human-agent collaboration requires human-readable output

Humans don't read memory dumps. Humans read documents with headings, sections, and narrative flow. If Uteke rooms are the bridge between agents and humans, the room output must be human-readable without LLM post-processing.

3. Composable workflows need structured output

Consider the orchestration flow from the Excalidraw diagram:

Room Discussion → Extract Task → Assign Agent → Agent executes → Report back to Room

For "Extract Task" to work, the room output must be structured enough that an agent can parse it and extract actionable items. A flat memory list requires the extracting agent to infer structure that should already exist.

Proposed Implementation

New concept: Room Document

A Room Document is a virtual document generated from room memories using structure inference — no explicit document editing needed. Agents continue to store individual memories as they do now. The "document" is a view over room memories, organized by structure inference rules.

Structure inference rules

Memories already have memory_type and tags. Use these as section classifiers:

memory_type Document Section
decision ## Decisions
fact ## Findings
procedure ## Procedures
context ## Context / Background
preference ## Preferences / Constraints
(default) ## Notes

Within each section, memories are:

New command: uteke room document

# Generate structured document from room memories
uteke room document <room_id>

# Filter by section type
uteke room document <room_id> --section decisions

# Filter by author
uteke room document <room_id> --author cto

# Limit memories included
uteke room document <room_id> --last 100

# Export format
uteke room document <room_id> --format markdown  # default
uteke room document <room_id> --format json
uteke room document <room_id> --format stdout    # human-readable

Example output (markdown):

# Room: project-kickoff
*Participants: cto, kai, zeko — 47 memories — Last activity: 2h ago*

## Decisions (8)
### Database
- **PostgreSQL with pgvector** — cto (2h ago)
  "Finalized on PostgreSQL, dropping MySQL option. pgvector gives us vector search without additional infrastructure."

### Authentication
- **JWT + refresh tokens** — zeko (1d ago)
  "JWT seems best for our SPA + mobile clients. Refresh tokens handle session continuity."

## Research Findings (12)
### Performance Benchmarks
- **pgvector latency** — kai (5h ago)
  "pgvector benchmarks: 85th percentile <5ms for 1M vectors, HNSW index, 768d embeddings."

## Open Questions (3)
- **GraphQL vs REST for v2 API** — debated 3 times, no consensus (last: 1d ago, cto)
- **Connection pooling strategy** — cto asked, no response yet (3h ago)

## Context (4)
- Project kickoff initiated to decide core tech stack for v2.0.
- Timeline: end of July for MVP.

Implementation approach

No schema changes. This is a view/query layer over existing room + memory data.

pub fn room_document(
    &self,
    room_id: &str,
    options: RoomDocumentOptions,  // last, author, section filter, format
) -> Result<RoomDocument, Error>

Algorithm:

  1. Fetch room memories (with optional author/limit filters)
  2. Group by memory_type → sections
  3. Within each section, cluster by semantic similarity (reuse embeddings)
  4. Sort clusters by most recent activity
  5. Format output (markdown, json, or structured type)

Optional enhancement: Allow agents to explicitly tag memories with section hints:

uteke remember "We decided on PostgreSQL" --room project-kickoff --author cto   --type decision --tags "section:decisions,topic:database"

The section:* tag overrides the default memory_type → section mapping.

Export integration

This issue sets up the structure. A follow-up could add:

  • uteke room document <room_id> --export file.md (write to file)
  • PDF export via external tool chain (headless Chrome, pandoc)

But the core feature (structured view over room memories) has no external dependencies.

MCP server update

{
  "name": "uteke_room_document",
  "description": "Generate a structured document from room memories, organized by type and topic",
  "input_schema": {
    "room_id": {"type": "string"},
    "section": {"type": "string", "description": "Filter to specific section (decisions, findings, questions, etc.)"},
    "author": {"type": "string", "optional": true},
    "last_memories": {"type": "number", "default": 100}
  }
}

Dependencies

Risks

  • Over-engineering risk: This could become a full document management system. We need to keep it as a view layer — agents store memories as before, the document is generated on read. No explicit "edit document" operations.
  • Noise from poorly-tagged memories: If agents don't use --type properly, section classification will be inaccurate. Mitigation: default to "Notes" section for unclassified memories, and document the tagging convention in README.

Closes

None (new feature)

Activity

  1. added
    scope:core
    type:feature
    v0.1.0
    on Jun 12, 2026
  2. ajianaz commented on Jun 13, 2026

    @ajianaz
    CollaboratorAuthor

    Implemented in PR #314, merged to develop.

  3. added this to the milestone on Jun 13, 2026
  4. added a commit that references this issue on Jun 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority:mediumscope:coretype:featurev0.1.0

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions