# Agora Project Tasks
# All Agora-related TODOs live here. gtd.org links to this file.
# Cross-reference: Passepartout integration at projects/passepartout

* PHASE: SPECIFICATION COMPLETE
All 10 requirement sections have been written. Gap analysis is done.

** DONE Create atomic notes for all 10 Agora sections
** DONE Fill CRITICAL and HIGH gaps [5 CRITICAL / 15 HIGH]
** DONE All MEDIUM and LOW gaps resolved
** FINAL STATUS: All Agora specification gaps complete

** PENDING INTEGRATE scattered specifications into requirements files [1/4]
Properties:
  CREATED: [2026-03-18 Wed 02:00]

NEXT: Move content flag schema into Section 04
NEXT: Move PDS sync into Section 03
NEXT: Move delta sync into Section 08
NEXT: Delete duplicate documents after integration

* PHASE: PASSEPARTOUT INTEGRATION (Parallel Track)

This is a PARALLEL TRACK — does not block the core Passepartout roadmap (v0.3.0 → v1.0.0).
Identity + DIDComm gateway skills can be built anytime without core changes.
PDS transformation should wait until v1.0.0+.

The goal: make Passepartout a first-class AI Sub-Agent on the Agora network.
Architecture: Passepartout IS the PDS. Notes use plists natively with dual UUID + CID addressing.

Key design decisions (captured 2026-05-02):
1. Passepartout IS the PDS — the agent runs a personal data store in-process
2. Agora Notes use plists natively, not JSON — the PDS speaks Lisp
3. Dual addressing: every Note has a stable UUID (same across edits) and a CID (content hash)
4. Org files on disk ARE the user-facing view of Notes — no separate format
5. Clients and Relays are separate components, can be in any language, speak HTTP
6. The unified plist format is internal to PDS ↔ agent; clients request JSON
7. Integration is a PARALLEL TRACK — does not block or delay the core Passepartout roadmap (v0.3.0 → v1.0.0)
8. Timeline: Identity DID + DIDComm gateway = anytime (small skills). PDS transformation = v1.0.0+

The unified data model bridges memory-object → Agora Note:
| memory-object field | Agora Note field |
|---------------------|------------------|
| org-object-id | uuid (stable) |
| org-object-hash | cid (content hash) |
| getf attrs :TITLE | payload (derived) |
| getf attrs :TAGS | routing/access-control hints |
| org-object-children | child CIDs, reply_to, thread_root |
| org-object-content | payload body |
| merkle hash | CIDv1 (same SHA-256, different formatting)

** DRAFT 1. DID Identity Skill (identity-did.org)
A new skill that manages an Ed25519 keypair and DID document for the agent.
- Generate master keypair on first run (BIP-44 derived or Ed25519 fresh)
- Construct ~did:agora:<fingerprint>~ DID
- Sign outputs with the key for provenance
- Store keys in the vault (~*vault-memory*~, already exists in passepartout.security-vault)

File: ~org/identity-did.org~ (new)
Depends on: ~ironclad~ (already in ASDF deps), ~cl-json~ (already in ASDF deps)

** DRAFT 2. DIDComm Gateway (gateway-didcomm.org)
A new gateway following the same pattern as Telegram/Signal in ~gateway-manager~.
- Register poll/send functions in ~*gateway-registry*~
- Poll: listen for incoming DIDComm messages from the Relay Network or PDS
- Send: wrap an action in a DIDComm encrypted envelope (~JWE~) and deliver via Relay
- Messages arrive as framed protocol plists (same as CLI/TUI/Telegram)

The DIDComm spec is complex (DIDComm v2, JWM/JWE, HMAC, etc.). Initial implementation
can be a thin wrapper: JSON plist → sign with DID key → send to PDS → poll for replies.

File: ~org/gateway-didcomm.org~ (new)
Depends on: ~identity-did~, ~cl-json~, + DIDComm serialization library

** DRAFT 3. Memory — Note Adapter (system-memory-note.org)
Bridges Agora Notes into Passepartout's memory system.
- ~note-ingest~: take a CIDv1 + JSON payload, compute Merkle hash, store in ~*memory-history*~
- ~note-index~: extract key fields (title, author, timestamp) from JSON and store in
  ~*memory-store*~ as a memory-object with ~:cid~ attribute pointing to the history entry
- ~note-edit~: create a new draft with modifications, new CID, pending signature
- ~note-publish~: sign the draft, push to PDS via DIDComm gateway

This is Option C: Notes are canonical (in history), memory is derivative (in active store).

File: ~org/system-memory-note.org~ (new)
Depends on: ~gateway-didcomm~, ~core-memory~ (existing)

** DRAFT 4. Agent Persona (system-agent-persona.org)
Publish Passepartout itself as an Agora AI Persona (per Section 07).
- Register a DID for the agent
- Expose a "capabilities" Note listing the agent's skills as algorithms
- Accept invocation Notes from other persona owners
- Log all actions to an auditable Note chain

File: ~org/system-agent-persona.org~ (new)
Depends on: ~identity-did~, ~gateway-didcomm~, ~core-skills~

** DRAFT 5. Compute Marketplace (system-compute-provider.org)
Optional: expose Passepartout's LLM backends as a compute offering on Agora's marketplace.
- Register available models (Ollama, etc.) as compute offerings
- Accept inference requests via encrypted DIDComm
- Settle via Lightning Network payments (when Agora's payment layer is implemented)

File: ~org/system-compute-provider.org~ (future)
Depends on: ~identity-did~, ~gateway-didcomm~, ~gateway-llm~, ~gateway-provider~

* PHASE: ALETHEIA ANALYSIS

** TODO Critically analyze Master_Architecture_Document for lessons learned
   and incorporation into Agora
   Properties:
     STATUS: PENDING USER INSTRUCTION
     NOTES: User to provide pointers before commencing critical reading.
     Do not proceed without explicit instruction.

* REFERENCE LINKS
- Agora requirements: ~/home/user/memex/projects/agora/docs/
- Gap analysis: ~/home/user/memex/projects/agora/docs/agora-consolidated-gap-analysis.org
- Passepartout repo: ~/home/user/memex/projects/passepartout
- Passepartout GTD: ~/home/user/memex/projects/passepartout/TODO.org
