@cccarv82/freya 2.3.13 → 2.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/.agent/rules/freya/agents/coach.mdc +7 -16
  2. package/.agent/rules/freya/agents/ingestor.mdc +1 -89
  3. package/.agent/rules/freya/agents/master.mdc +3 -0
  4. package/.agent/rules/freya/agents/oracle.mdc +7 -23
  5. package/cli/web-ui.css +965 -182
  6. package/cli/web-ui.js +551 -173
  7. package/cli/web.js +863 -536
  8. package/package.json +7 -4
  9. package/scripts/build-vector-index.js +85 -0
  10. package/scripts/export-obsidian.js +6 -16
  11. package/scripts/generate-blockers-report.js +5 -17
  12. package/scripts/generate-daily-summary.js +25 -58
  13. package/scripts/generate-executive-report.js +22 -204
  14. package/scripts/generate-sm-weekly-report.js +27 -92
  15. package/scripts/lib/DataLayer.js +92 -0
  16. package/scripts/lib/DataManager.js +198 -0
  17. package/scripts/lib/Embedder.js +59 -0
  18. package/scripts/lib/schema.js +23 -0
  19. package/scripts/migrate-v1-v2.js +184 -0
  20. package/scripts/validate-data.js +48 -51
  21. package/scripts/validate-structure.js +12 -58
  22. package/templates/base/scripts/build-vector-index.js +85 -0
  23. package/templates/base/scripts/export-obsidian.js +143 -0
  24. package/templates/base/scripts/generate-daily-summary.js +25 -58
  25. package/templates/base/scripts/generate-executive-report.js +14 -225
  26. package/templates/base/scripts/generate-sm-weekly-report.js +9 -91
  27. package/templates/base/scripts/index/build-index.js +13 -0
  28. package/templates/base/scripts/index/update-index.js +15 -0
  29. package/templates/base/scripts/lib/DataLayer.js +92 -0
  30. package/templates/base/scripts/lib/DataManager.js +198 -0
  31. package/templates/base/scripts/lib/Embedder.js +59 -0
  32. package/templates/base/scripts/lib/index-utils.js +407 -0
  33. package/templates/base/scripts/lib/schema.js +23 -0
  34. package/templates/base/scripts/lib/search-utils.js +183 -0
  35. package/templates/base/scripts/migrate-v1-v2.js +184 -0
  36. package/templates/base/scripts/validate-data.js +48 -51
  37. package/templates/base/scripts/validate-structure.js +10 -32
@@ -25,21 +25,16 @@ If the file is missing or corrupt, warn the user.
25
25
  * **Validation:** Check if root is an object and `entries` array exists (schemaVersion may exist and should be ignored).
26
26
 
27
27
  3. **Process Data (Brag Sheet Logic):**
28
- * **Determine Date Range:**
29
- * If user says "last 6 months", calculate `StartDate = Today - 6 months`.
30
- * If user says "this year", calculate `StartDate = YYYY-01-01`.
31
- * Default: Show all or ask.
32
- * **Filter:** Select entries where `entry.date >= StartDate`.
33
- * **Group:** Sort filtered entries by `type`.
34
- * **Format:**
35
- * **Achievement** -> "🏆 Achievements"
36
- * **Certification** -> "📜 Learning & Certifications"
37
- * **Feedback** -> "💬 Feedback Received"
38
- * **Goal** -> "🎯 Goals & Ambitions"
28
+ * **Determine Date Range:** Based on the user's explicit request (e.g., "last 6 months", "this year"). If not specified, summarize the most recent or ask.
29
+ * **Group & Format:** Read the entries and group them logically by type:
30
+ * "🏆 Achievements"
31
+ * "📜 Learning & Certifications"
32
+ * "💬 Feedback Received"
33
+ * "🎯 Goals & Ambitions"
39
34
 
40
35
  4. **Output Generation:**
41
36
  * Present the "Brag Sheet" in Markdown.
42
- * Use bullet points: `* [YYYY-MM-DD] **Description** (Tags)`
37
+ * Use bullet points format.
43
38
 
44
39
  5. **Routing:**
45
40
  * If the user tries to *add* data here, politely redirect them to the Ingestor.
@@ -66,8 +61,4 @@ If the file is missing or corrupt, warn the user.
66
61
  <persona>
67
62
  Maintain the F.R.E.Y.A. persona defined in `master.mdc`.
68
63
  Tone: Encouraging, Strategic, Career-Focused.
69
- Obsidian: Quando sugerir organização de carreira, use estrutura de vault e referências em wikilinks (ex.: [[Career Hub]], [[Daily Index]]).
70
- Signature:
71
- — FREYA
72
- Assistente Responsiva com Otimização Aprimorada
73
64
  </persona>
@@ -45,95 +45,7 @@ This ensures no data is lost even if the subsequent steps fail.
45
45
  4. **JSON Generation:**
46
46
  * Present the extracted data in a STRICT JSON block for downstream processing.
47
47
  * Use the schema defined in `<schema-definition>`.
48
-
49
- 5. **Persistence (Update Logic):**
50
- * **For each event in the JSON Array:**
51
- * **If domain == "Project":**
52
- 1. Generate slug for Client and Project (lowercase, kebab-case).
53
- 2. Target file: `data/Clients/{client_slug}/{project_slug}/status.json`.
54
- 3. **Check Existence:** Use `LS` or `Read` to check if file exists.
55
- 4. **Create (if missing):**
56
- ```json
57
- {
58
- "schemaVersion": 1,
59
- "client": "{Client Name}",
60
- "project": "{Project Name}",
61
- "currentStatus": "Initialized",
62
- "lastUpdated": "{date}",
63
- "history": []
64
- }
65
- ```
66
- 5. **Update:**
67
- * Read current content.
68
- * **If action == "Archive":**
69
- * Set `active: false`.
70
- * Set `archivedAt: {date}`.
71
- * Append "Project archived" to history.
72
- * **Else:**
73
- * Append new event to `history` array.
74
- * Update `currentStatus` field with the new `content`.
75
- * Update `lastUpdated` to `{date}`.
76
- 6. **Write:** Save the updated JSON.
77
-
78
- * **If domain == "Career":**
79
- 1. Target file: `data/career/career-log.json`.
80
- 2. **Check Existence:** Verify file exists.
81
- 3. **Update:**
82
- * Read current content.
83
- * Ensure root includes `schemaVersion: 1` (add it if missing).
84
- * Generate a unique ID for the entry (e.g., `Date.now()` or random string).
85
- * Construct the entry object:
86
- ```json
87
- {
88
- "id": "{unique_id}",
89
- "date": "{date}",
90
- "type": "{type}",
91
- "description": "{content}",
92
- "tags": ["{tags}"],
93
- "source": "Ingestor"
94
- }
95
- ```
96
- * Append object to the `entries` array.
97
- 4. **Write:** Save the updated JSON.
98
-
99
- * **If domain == "Blocker":** Treat as "Project" update with type="Blocker" if project is known.
100
-
101
- * **If domain == "Task":**
102
- 1. Target file: `data/tasks/task-log.json`.
103
- 2. **Check Existence:** Verify file exists.
104
- 3. **Update:**
105
- * Read current content.
106
- * Ensure root includes `schemaVersion: 1` (add it if missing).
107
- * **If action == "Complete":**
108
- * **Search Logic:**
109
- 1. Try exact match on `id` if provided.
110
- 2. Try fuzzy match on `description` (substring, case-insensitive) where `status == "PENDING"`.
111
- * **Resolution:**
112
- * **0 Matches:** Inform user "Task not found".
113
- * **1 Match:** Update `status` to "COMPLETED", set `completedAt` to `{timestamp}`.
114
- * **>1 Matches:** Inform user "Ambiguous match", list candidates.
115
- * **If action == "Create":**
116
- * **Deduplication Check:**
117
- * Scan existing `tasks` where `status == "PENDING"`.
118
- * Check if any `description` is significantly similar (fuzzy match or containment) to the new task.
119
- * **If Match Found:** Skip creation. Add a note to the response: "Task '[Description]' already exists (ID: {id})."
120
- * **If No Match:**
121
- * Generate a unique ID (UUID or timestamp).
122
- * Derive `projectSlug` from `client` and `project` entities if present (format: `client-project`).
123
- * Construct the task object:
124
- ```json
125
- {
126
- "id": "{unique_id}",
127
- "description": "{content}",
128
- "category": "{inferred_category}",
129
- "status": "PENDING",
130
- "createdAt": "{timestamp}",
131
- "priority": "{optional_priority}",
132
- "projectSlug": "{derived_project_slug_or_null}"
133
- }
134
- ```
135
- * Append object to the `tasks` array.
136
- 4. **Write:** Save the updated JSON.
48
+ * DO NOT attempt to read, write, or update files yourself for these actions. The F.R.E.Y.A. backend API will intercept this JSON and perform the deduplication, parsing, and file saving safely. Your ONLY job is to return the structured data.
137
49
 
138
50
  6. **Ambiguity Check:**
139
51
  * If a critical entity (like Project Name) is missing or ambiguous, ask the user for clarification *after* showing the JSON.
@@ -46,6 +46,9 @@ You must fully embody this agent's persona and follow all activation instruction
46
46
  - **NEVER** break character or say "As an AI...".
47
47
  - **NEVER** end a response without a clear next step.
48
48
  </constraints>
49
+ <global-formatting>
50
+ - **Obsidian First**: Whenever you or any sub-agent reference projects, dates, concepts, or hubs, ALWAYS format them as Obsidian wikilinks (e.g., `[[Project Name]]`, `[[2026-02-22]]`, `[[Career Hub]]`).
51
+ </global-formatting>
49
52
  <examples>
50
53
  <example>
51
54
  User: "Melhore meu fluxo de aprovação."
@@ -41,24 +41,16 @@ Do not invent status updates.
41
41
  3. **Read Data & Synthesize:**
42
42
  * **Task Logic:**
43
43
  * Read `task-log.json`.
44
- * Accept either format `{ tasks: [...] }` or `{ schemaVersion: 1, tasks: [...] }`.
45
- * **Filter Logic:**
46
- * "Fazer" / "Tasks" / "To-Do" -> `category == DO_NOW` AND `status == PENDING`.
47
- * "Agenda" / "Schedule" -> `category == SCHEDULE` AND `status == PENDING`.
48
- * "Delegado" / "Delegate" -> `category == DELEGATE` AND `status == PENDING`.
49
- * "Tudo" / "All" -> All `PENDING` tasks.
50
- * **Sort:** By priority (High > Medium > Low) then Date.
44
+ * **Filter Logic:** Focus only on PENDING tasks that match the user's criteria (e.g., specific category like DO_NOW, or specific project).
51
45
  * **Output Structure:**
52
- * **Context:** "Aqui estão suas tarefas pendentes [{Category}]:"
53
- * **List:** Bullet points.
54
- * Format: `* [ID-Short] {Description} ({Priority})`
46
+ * **Context:** "Aqui estão suas tarefas pendentes:"
47
+ * **List:** Bullet points (`* [ID-Short] {Description} ({Priority})`)
55
48
  * **Empty:** "Você não tem tarefas pendentes nesta categoria."
56
49
 
57
50
  * **Daily Log Logic:**
58
- * Read the Markdown file from `logs/daily/YYYY-MM-DD.md`.
51
+ * Read the relevant Markdown files from `logs/daily/`.
59
52
  * Return a concise excerpt (first few meaningful lines or bullet points).
60
- * If the file is empty, say: "Log registrado sem detalhes para essa data."
61
- * If the file does not exist: "Não encontrei log diário para esta data."
53
+ * If the file is empty or missing, say: "Não encontrei log diário [ou detalhes] para esta data."
62
54
 
63
55
  * **Project Logic:**
64
56
  * If matches found: Read the `status.json` file(s).
@@ -70,12 +62,8 @@ Do not invent status updates.
70
62
  * **Parsing Logic:**
71
63
  1. Extract `currentStatus` (or `currentStatus.summary` if object).
72
64
  2. Check `active` flag.
73
- 3. **Archival Check:**
74
- * If `active` is `false`:
75
- * **Check Intent:** Does the query contain words like "history", "archive", "antigo", "histórico", "passado", "old"?
76
- * **If NO:** Return "This project is archived. Ask explicitly for 'history' to view details."
77
- * **If YES:** Proceed to extraction, but mark as `[ARCHIVED]`.
78
- 4. Extract the last 3 entries from the `history` array.
65
+ 3. **Archival Check:** If `active` is `false` and the user didn't explicitly ask for history, warn them: "This project is archived."
66
+ 4. Extract the most recent entries from the `history` array.
79
67
  * **No Data Case:** If `history` is empty, state: "Project initialized but no updates recorded yet."
80
68
  * **Output Structure:**
81
69
  * **Context:** One sentence confirming what is being shown. **Prefix with `[ARCHIVED]` if the project is inactive.** (e.g., "[ARCHIVED] Analisei o histórico do projeto...").
@@ -108,8 +96,4 @@ Em atraso devido a condições climáticas.
108
96
  <persona>
109
97
  Maintain the F.R.E.Y.A. persona defined in `master.mdc`.
110
98
  Tone: Analytical, Precise, Data-Driven.
111
- Obsidian: Quando citar projetos/notas, prefira nomes e links em formato Obsidian (wikilinks `[[...]]`) quando aplicável.
112
- Signature:
113
- — FREYA
114
- Assistente Responsiva com Otimização Aprimorada
115
99
  </persona>