|
| 1 | +# inbox Specification |
| 2 | + |
| 3 | +## Purpose |
| 4 | + |
| 5 | +Define the inbox capture and triage system for JDO, enabling quick capture of raw text from external sources and AI-assisted classification into proper domain objects. |
| 6 | + |
| 7 | +## ADDED Requirements |
| 8 | + |
| 9 | +### Requirement: CLI Capture Command |
| 10 | + |
| 11 | +The system SHALL provide a CLI command to capture raw text for later triage. |
| 12 | + |
| 13 | +#### Scenario: Capture text from command line |
| 14 | +- **WHEN** user runs `jdo capture "finish the quarterly report"` |
| 15 | +- **THEN** a Draft is created with `entity_type=UNKNOWN` and `partial_data={"raw_text": "finish the quarterly report"}` |
| 16 | +- **AND** the command prints "Captured for triage" and exits with code 0 |
| 17 | + |
| 18 | +#### Scenario: Capture empty text rejected |
| 19 | +- **WHEN** user runs `jdo capture ""` |
| 20 | +- **THEN** the command prints an error message and exits with code 1 |
| 21 | +- **AND** no Draft is created |
| 22 | + |
| 23 | +#### Scenario: Capture with special characters |
| 24 | +- **WHEN** user runs `jdo capture "meeting with Sarah @ 3pm re: budget"` |
| 25 | +- **THEN** the text is stored exactly as provided, preserving special characters |
| 26 | + |
| 27 | +#### Scenario: Multiple captures create separate items |
| 28 | +- **WHEN** user runs `jdo capture "item 1"` then `jdo capture "item 2"` |
| 29 | +- **THEN** two separate Draft records are created with sequential timestamps |
| 30 | + |
| 31 | +### Requirement: Triage Command |
| 32 | + |
| 33 | +The system SHALL provide a `/triage` command to process inbox items. |
| 34 | + |
| 35 | +#### Scenario: Start triage with items |
| 36 | +- **WHEN** user types `/triage` and there are items needing triage |
| 37 | +- **THEN** the system displays the first item with AI analysis and action options |
| 38 | + |
| 39 | +#### Scenario: Start triage with no items |
| 40 | +- **WHEN** user types `/triage` and there are no items needing triage |
| 41 | +- **THEN** the system responds "No items to triage. Your inbox is empty." |
| 42 | + |
| 43 | +#### Scenario: Triage available from chat |
| 44 | +- **WHEN** user is on the chat screen and types `/triage` |
| 45 | +- **THEN** triage mode starts in the current chat session |
| 46 | + |
| 47 | +#### Scenario: Triage available from home |
| 48 | +- **WHEN** user presses `t` on the home screen with items needing triage |
| 49 | +- **THEN** the system navigates to chat and starts triage mode |
| 50 | + |
| 51 | +### Requirement: AI Classification |
| 52 | + |
| 53 | +The system SHALL use AI to analyze and classify triage items. |
| 54 | + |
| 55 | +#### Scenario: AI suggests object type |
| 56 | +- **WHEN** a triage item is displayed |
| 57 | +- **THEN** the AI analyzes the text and suggests: object type, confidence level, and detected entities (stakeholders, dates, potential links) |
| 58 | + |
| 59 | +#### Scenario: High confidence suggestion |
| 60 | +- **WHEN** AI confidence is high (>= 0.7) |
| 61 | +- **THEN** the AI presents its suggestion directly: "This looks like a Commitment to Sarah, due Friday." |
| 62 | + |
| 63 | +#### Scenario: Low confidence clarification |
| 64 | +- **WHEN** AI confidence is low (< 0.7) |
| 65 | +- **THEN** the AI asks a simple clarifying question: "Is this something you need to do, or a goal you want to achieve?" |
| 66 | + |
| 67 | +#### Scenario: Entity detection |
| 68 | +- **WHEN** AI analyzes "finish report for Sarah by Friday" |
| 69 | +- **THEN** it detects: stakeholder "Sarah" (matches existing if present), due date "Friday", and suggests linking opportunities |
| 70 | + |
| 71 | +### Requirement: Triage Actions |
| 72 | + |
| 73 | +The system SHALL support user actions during triage. |
| 74 | + |
| 75 | +#### Scenario: Accept suggestion |
| 76 | +- **WHEN** user selects "Accept" (or presses 1) |
| 77 | +- **THEN** the Draft's `entity_type` is updated to the suggested type |
| 78 | +- **AND** the normal creation flow begins with pre-filled fields from AI extraction |
| 79 | + |
| 80 | +#### Scenario: Change type |
| 81 | +- **WHEN** user selects "Change type" (or presses 2) |
| 82 | +- **THEN** the system prompts: "What type? [c]ommitment, [g]oal, [t]ask, [v]ision, [m]ilestone" |
| 83 | +- **AND** user selection updates the Draft and proceeds to creation flow |
| 84 | + |
| 85 | +#### Scenario: Delete item |
| 86 | +- **WHEN** user selects "Delete" (or presses 3) |
| 87 | +- **THEN** the Draft is permanently deleted |
| 88 | +- **AND** the system proceeds to the next triage item |
| 89 | + |
| 90 | +#### Scenario: Skip item |
| 91 | +- **WHEN** user selects "Skip" (or presses 4) |
| 92 | +- **THEN** the system proceeds to the next item |
| 93 | +- **AND** the skipped item remains at the front of the queue for next triage session |
| 94 | + |
| 95 | +### Requirement: Triage Queue Management |
| 96 | + |
| 97 | +The system SHALL manage the triage queue with FIFO ordering. |
| 98 | + |
| 99 | +#### Scenario: FIFO ordering |
| 100 | +- **WHEN** multiple items need triage |
| 101 | +- **THEN** they are presented in order of capture (oldest first) |
| 102 | + |
| 103 | +#### Scenario: Queue persists across sessions |
| 104 | +- **WHEN** user exits triage before completing all items |
| 105 | +- **THEN** remaining items stay in the queue for the next session |
| 106 | + |
| 107 | +#### Scenario: Partial progress saved |
| 108 | +- **WHEN** user accepts a type but exits before completing creation |
| 109 | +- **THEN** the item becomes a normal Draft with the confirmed `entity_type` |
| 110 | +- **AND** it is removed from the triage queue (no longer UNKNOWN) |
| 111 | + |
| 112 | +#### Scenario: Triage completion |
| 113 | +- **WHEN** user processes the last item in the queue |
| 114 | +- **THEN** the system displays "Triage complete! All items processed." |
| 115 | + |
| 116 | +### Requirement: Vague Chat Input Detection |
| 117 | + |
| 118 | +The system SHALL detect vague input in chat and offer triage. |
| 119 | + |
| 120 | +#### Scenario: Unclassifiable input creates triage item |
| 121 | +- **WHEN** user enters "remember to call mom" in chat (no command, unclear type) |
| 122 | +- **AND** AI cannot determine object type with confidence |
| 123 | +- **THEN** a Draft with `entity_type=UNKNOWN` is created |
| 124 | +- **AND** AI responds: "I'm not sure what type of item this should be. I've added it to your triage queue. Would you like to triage it now?" |
| 125 | + |
| 126 | +#### Scenario: User accepts immediate triage |
| 127 | +- **WHEN** user responds "yes" to the triage offer |
| 128 | +- **THEN** the system starts triage mode with the new item first |
| 129 | + |
| 130 | +#### Scenario: User defers triage |
| 131 | +- **WHEN** user responds "no" or continues with other input |
| 132 | +- **THEN** the item remains in the triage queue |
| 133 | +- **AND** the conversation continues normally |
| 134 | + |
| 135 | +#### Scenario: Clear intent proceeds normally |
| 136 | +- **WHEN** user enters text with clear intent (e.g., "I need to send the report to Sarah by Friday") |
| 137 | +- **THEN** AI proceeds with normal creation flow (e.g., suggests `/commit`) |
| 138 | +- **AND** no triage item is created |
0 commit comments