feat: refactor work item file retrieval to use Python script for improved error handling and readability

This commit is contained in:
2026-05-04 09:45:28 -06:00
parent 541c9b43de
commit ff4ed6a759
12 changed files with 195 additions and 143 deletions

View File

@@ -19,7 +19,28 @@ Read active profile, if present:
Relevant active work item files, if available: Relevant active work item files, if available:
!`if [ -d project-knowledge/02-work-items ]; then for f in project-knowledge/02-work-items/*.md; do case "$f" in *README.md|*index.md) continue;; esac; echo "\n### $f"; cat "$f"; done; else echo "No work item files available."; fi` !`python3 - <<'PY'
import re
from pathlib import Path
summary = Path("project-knowledge/01-current/work-items.md")
if not summary.is_file():
print("No work item files available.")
raise SystemExit(0)
text = summary.read_text()
paths = re.findall(r"Detail: `(project-knowledge/02-work-items/[^`]+)`", text)
if not paths:
print("No work item files available.")
raise SystemExit(0)
for rel in paths:
path = Path(rel)
if not path.is_file():
continue
print(f"\n### {rel}")
print(path.read_text())
PY`
User request: User request:

View File

@@ -24,7 +24,28 @@ Active profile, if present:
Detailed active work item files, if available: Detailed active work item files, if available:
!`if [ -d project-knowledge/02-work-items ]; then for f in project-knowledge/02-work-items/*.md; do case "$f" in *README.md|*index.md) continue;; esac; echo "\n### $f"; cat "$f"; done; else echo "No work item files available."; fi` !`python3 - <<'PY'
import re
from pathlib import Path
summary = Path("project-knowledge/01-current/work-items.md")
if not summary.is_file():
print("No work item files available.")
raise SystemExit(0)
text = summary.read_text()
paths = re.findall(r"Detail: `(project-knowledge/02-work-items/[^`]+)`", text)
if not paths:
print("No work item files available.")
raise SystemExit(0)
for rel in paths:
path = Path(rel)
if not path.is_file():
continue
print(f"\n### {rel}")
print(path.read_text())
PY`
User request: User request:

View File

@@ -6,34 +6,17 @@ Load and internalize the active context for this Fidelity workspace before answe
Use these files as the baseline context: Use these files as the baseline context:
@README.md
@core/README.md
@core/memory/operational-memory.md
@core/integrations/memory-vault-model.md
@core/integrations/communication-model.md
@profiles/fidelity/profile.md @profiles/fidelity/profile.md
@agent-memory/README.md @agent-memory/behavior/agent-behavior.md
@agent-memory/behavior/learning-sessions.md @agent-memory/behavior/learning-sessions.md
@agent-memory/behavior/self-maintenance.md @agent-memory/memory/promotion-rules.md
@agent-memory/memory/operational-memory.md @agent-memory/integrations/technical-verification.md
@agent-memory/integrations/memory-interface.md
@agent-memory/integrations/obsidian.md
@agent-memory/integrations/communication-sources.md
@project-knowledge/00-start/start-here.md @project-knowledge/00-start/start-here.md
@project-knowledge/01-current/current-work.md @project-knowledge/01-current/current-work.md
@project-knowledge/01-current/work-items.md @project-knowledge/01-current/work-items.md
@project-knowledge/07-maps/current-work.md
@project-knowledge/07-maps/fidelity-domain.md
@project-knowledge/07-maps/work-items.md
@project-knowledge/07-maps/people.md
@project-knowledge/03-context/project.md @project-knowledge/03-context/project.md
@project-knowledge/03-context/process/communication.md @project-knowledge/03-context/process/communication.md
@agent-memory/integrations/technical-verification.md @project-knowledge/03-context/ios/index.md
@agent-memory/workflows/ai-to-ai-prompting.md
@project-knowledge/03-context/process/jira-story-rules.md
@agent-memory/workflows/workspace-model.md
@agent-memory/behavior/agent-behavior.md
@agent-memory/memory/promotion-rules.md
@project-knowledge/04-people/manager.md @project-knowledge/04-people/manager.md
@project-knowledge/04-people/index.md @project-knowledge/04-people/index.md
@@ -45,13 +28,34 @@ Today's canonical daily note, if present:
!`if [ -f project-knowledge/06-daily/$(date +%F).md ]; then cat project-knowledge/06-daily/$(date +%F).md; else echo "No daily note exists for today yet."; fi` !`if [ -f project-knowledge/06-daily/$(date +%F).md ]; then cat project-knowledge/06-daily/$(date +%F).md; else echo "No daily note exists for today yet."; fi`
Recent daily notes available: Latest daily notes available:
!`if [ -d project-knowledge/06-daily ]; then ls -1 project-knowledge/06-daily 2>/dev/null | sort | tail -n 5; else echo "No daily notes directory available."; fi` !`if [ -d project-knowledge/06-daily ]; then ls -1 project-knowledge/06-daily 2>/dev/null | sort | tail -n 3; else echo "No daily notes directory available."; fi`
Detailed active work item files, if available: Detailed active work item files, if available:
!`if [ -d project-knowledge/02-work-items ]; then for f in project-knowledge/02-work-items/*.md; do case "$f" in *README.md|*index.md) continue;; esac; echo "\n### $f"; cat "$f"; done; else echo "No work item files available."; fi` !`python3 - <<'PY'
import re
from pathlib import Path
summary = Path("project-knowledge/01-current/work-items.md")
if not summary.is_file():
print("No work item files available.")
raise SystemExit(0)
text = summary.read_text()
paths = re.findall(r"Detail: `(project-knowledge/02-work-items/[^`]+)`", text)
if not paths:
print("No work item files available.")
raise SystemExit(0)
for rel in paths:
path = Path(rel)
if not path.is_file():
continue
print(f"\n### {rel}")
print(path.read_text())
PY`
Latest Mattermost context, if available: Latest Mattermost context, if available:

View File

@@ -12,7 +12,6 @@ Read:
@project-knowledge/01-current/current-work.md @project-knowledge/01-current/current-work.md
@project-knowledge/01-current/work-items.md @project-knowledge/01-current/work-items.md
@project-knowledge/03-context/project.md @project-knowledge/03-context/project.md
@project-knowledge/03-context/workstreams/index.md
@project-knowledge/03-context/process/communication.md @project-knowledge/03-context/process/communication.md
@project-knowledge/04-people/manager.md @project-knowledge/04-people/manager.md
@project-knowledge/04-people/index.md @project-knowledge/04-people/index.md
@@ -27,7 +26,28 @@ Latest Mattermost context, if available:
Detailed active work item files, if available: Detailed active work item files, if available:
!`if [ -d project-knowledge/02-work-items ]; then for f in project-knowledge/02-work-items/*.md; do case "$f" in *README.md|*index.md) continue;; esac; echo "\n### $f"; cat "$f"; done; else echo "No work item files available."; fi` !`python3 - <<'PY'
import re
from pathlib import Path
summary = Path("project-knowledge/01-current/work-items.md")
if not summary.is_file():
print("No work item files available.")
raise SystemExit(0)
text = summary.read_text()
paths = re.findall(r"Detail: `(project-knowledge/02-work-items/[^`]+)`", text)
if not paths:
print("No work item files available.")
raise SystemExit(0)
for rel in paths:
path = Path(rel)
if not path.is_file():
continue
print(f"\n### {rel}")
print(path.read_text())
PY`
User draft or rough notes: User draft or rough notes:

View File

@@ -4,18 +4,24 @@ description: Draft a standup from the latest Fidelity workspace context
Generate a standup update using the latest workspace state. Generate a standup update using the latest workspace state.
First, refresh Mattermost context before drafting: First, refresh previous-workday Mattermost context before drafting:
!`python3 - <<'PY' !`python3 - <<'PY'
import os import os
import subprocess import subprocess
from pathlib import Path from pathlib import Path
from datetime import date
cmd = os.environ.get("AIW_MATTERMOST_SYNC_CMD") or os.environ.get("FIDELITY_MATTERMOST_SYNC_CMD") cmd = os.environ.get("AIW_MATTERMOST_SYNC_CMD") or os.environ.get("FIDELITY_MATTERMOST_SYNC_CMD")
if cmd: today = date.today().isoformat()
if Path("scripts/mattermost/sync.sh").is_file():
result = subprocess.run(
["bash", "scripts/mattermost/sync.sh", "--previous-workday", "--today", today],
capture_output=True,
text=True,
)
elif cmd:
result = subprocess.run(["bash", "-lc", cmd], capture_output=True, text=True) result = subprocess.run(["bash", "-lc", cmd], capture_output=True, text=True)
elif Path("scripts/mattermost/sync.sh").is_file():
result = subprocess.run(["bash", "scripts/mattermost/sync.sh"], capture_output=True, text=True)
else: else:
print("No Mattermost sync command configured.") print("No Mattermost sync command configured.")
raise SystemExit(0) raise SystemExit(0)
@@ -34,28 +40,17 @@ PY`
Read: Read:
@prompts/standup.md @prompts/standup.md
@project-knowledge/00-start/start-here.md
@project-knowledge/01-current/current-work.md @project-knowledge/01-current/current-work.md
@project-knowledge/01-current/work-items.md @project-knowledge/01-current/work-items.md
@project-knowledge/03-context/project.md @project-knowledge/03-context/project.md
@project-knowledge/03-context/workstreams/index.md
@project-knowledge/03-context/workstreams/flow-page-references.md @project-knowledge/03-context/workstreams/flow-page-references.md
@project-knowledge/03-context/process/communication.md @project-knowledge/03-context/process/communication.md
@project-knowledge/03-context/process/jira-story-rules.md
@project-knowledge/04-people/manager.md @project-knowledge/04-people/manager.md
Previous workday Mattermost context, if present:
!`bash scripts/mattermost/sync.sh --previous-workday --today "$(date +%F)"`
Today's log, if present: Today's log, if present:
!`if [ -f project-knowledge/06-daily/$(date +%F).md ]; then cat project-knowledge/06-daily/$(date +%F).md; else echo "No daily note exists for today yet."; fi` !`if [ -f project-knowledge/06-daily/$(date +%F).md ]; then cat project-knowledge/06-daily/$(date +%F).md; else echo "No daily note exists for today yet."; fi`
Latest Mattermost context, preferring inbox and falling back to generated JSONL:
!`if [ -s ai/inbox/mattermost-latest.md ]; then cat ai/inbox/mattermost-latest.md; elif [ -s scripts/mattermost/generated/mattermost_context.jsonl ]; then cat scripts/mattermost/generated/mattermost_context.jsonl; else echo "No Mattermost context available."; fi`
Detailed active work item files, if available: Detailed active work item files, if available:
!`python3 - <<'PY' !`python3 - <<'PY'

View File

@@ -40,7 +40,28 @@ Latest Mattermost context, if available:
Detailed active work item files, if available: Detailed active work item files, if available:
!`if [ -d project-knowledge/02-work-items ]; then for f in project-knowledge/02-work-items/*.md; do case "$f" in *README.md|*index.md) continue;; esac; echo "\n### $f"; cat "$f"; done; else echo "No work item files available."; fi` !`python3 - <<'PY'
import re
from pathlib import Path
summary = Path("project-knowledge/01-current/work-items.md")
if not summary.is_file():
print("No work item files available.")
raise SystemExit(0)
text = summary.read_text()
paths = re.findall(r"Detail: `(project-knowledge/02-work-items/[^`]+)`", text)
if not paths:
print("No work item files available.")
raise SystemExit(0)
for rel in paths:
path = Path(rel)
if not path.is_file():
continue
print(f"\n### {rel}")
print(path.read_text())
PY`
Requirements: Requirements:

View File

@@ -6,37 +6,20 @@ Load and internalize the reusable workspace core and the active project context
Read core: Read core:
@core/README.md @profiles/fidelity/profile.md
@core/memory/operational-memory.md @agent-memory/behavior/agent-behavior.md
@core/integrations/memory-vault-model.md
@core/integrations/communication-model.md
@core/profiles/create-project-profile.md
@agent-memory/README.md
@agent-memory/behavior/learning-sessions.md @agent-memory/behavior/learning-sessions.md
@agent-memory/behavior/self-maintenance.md @agent-memory/memory/promotion-rules.md
@agent-memory/memory/operational-memory.md @agent-memory/integrations/technical-verification.md
@agent-memory/integrations/memory-interface.md
@agent-memory/integrations/obsidian.md
@agent-memory/integrations/communication-sources.md
Read active workspace memory: Read active workspace memory:
@README.md
@project-knowledge/00-start/start-here.md @project-knowledge/00-start/start-here.md
@project-knowledge/00-start/onboarding.md
@project-knowledge/01-current/current-work.md @project-knowledge/01-current/current-work.md
@project-knowledge/01-current/work-items.md @project-knowledge/01-current/work-items.md
@project-knowledge/07-maps/current-work.md
@project-knowledge/07-maps/fidelity-domain.md
@project-knowledge/07-maps/work-items.md
@project-knowledge/07-maps/people.md
@project-knowledge/03-context/project.md @project-knowledge/03-context/project.md
@project-knowledge/03-context/process/communication.md @project-knowledge/03-context/process/communication.md
@agent-memory/integrations/technical-verification.md @project-knowledge/03-context/ios/index.md
@agent-memory/memory/context-maintenance.md
@agent-memory/workflows/workspace-model.md
@agent-memory/behavior/agent-behavior.md
@agent-memory/memory/promotion-rules.md
@project-knowledge/04-people/manager.md @project-knowledge/04-people/manager.md
@project-knowledge/04-people/index.md @project-knowledge/04-people/index.md
@@ -52,13 +35,34 @@ Today's canonical daily note, if present:
!`if [ -f project-knowledge/06-daily/$(date +%F).md ]; then cat project-knowledge/06-daily/$(date +%F).md; else echo "No daily note exists for today yet."; fi` !`if [ -f project-knowledge/06-daily/$(date +%F).md ]; then cat project-knowledge/06-daily/$(date +%F).md; else echo "No daily note exists for today yet."; fi`
Recent daily notes available: Latest daily notes available:
!`if [ -d project-knowledge/06-daily ]; then ls -1 project-knowledge/06-daily 2>/dev/null | sort | tail -n 5; else echo "No daily notes directory available."; fi` !`if [ -d project-knowledge/06-daily ]; then ls -1 project-knowledge/06-daily 2>/dev/null | sort | tail -n 3; else echo "No daily notes directory available."; fi`
Detailed active work item files, if available: Detailed active work item files, if available:
!`if [ -d project-knowledge/02-work-items ]; then for f in project-knowledge/02-work-items/*.md; do case "$f" in *README.md|*index.md) continue;; esac; echo "\n### $f"; cat "$f"; done; else echo "No work item files available."; fi` !`python3 - <<'PY'
import re
from pathlib import Path
summary = Path("project-knowledge/01-current/work-items.md")
if not summary.is_file():
print("No work item files available.")
raise SystemExit(0)
text = summary.read_text()
paths = re.findall(r"Detail: `(project-knowledge/02-work-items/[^`]+)`", text)
if not paths:
print("No work item files available.")
raise SystemExit(0)
for rel in paths:
path = Path(rel)
if not path.is_file():
continue
print(f"\n### {rel}")
print(path.read_text())
PY`
Latest communication inbox, if available: Latest communication inbox, if available:

View File

@@ -33,7 +33,7 @@ Behavior rules:
- If missing context materially affects the answer, ask a concise clarification question instead of inventing details. - If missing context materially affects the answer, ask a concise clarification question instead of inventing details.
- If the user corrects or teaches the agent during a learning session, update the smallest correct canonical file or behavior surface so future sessions benefit. - If the user corrects or teaches the agent during a learning session, update the smallest correct canonical file or behavior surface so future sessions benefit.
- For any meaningful prompt, decide whether the interaction adds, corrects, or sharpens project memory. - For any meaningful prompt, decide whether the interaction adds, corrects, or sharpens project memory.
- When the user provides new durable information, update the right workspace files before or while answering. - When the user provides new durable information, update the right workspace files during the same turn when the destination is clear, but do not delay a straightforward answer just to create or reorganize memory.
- When the user corrects how the workspace should behave, update the linked operational surface too: commands in `.opencode/commands/`, prompt templates in `prompts/`, agent rules in `AGENTS.md` or `.opencode/agents/`, skills in `.opencode/skills/`, and agent operating rules in `agent-memory/` when those files control the behavior. - When the user corrects how the workspace should behave, update the linked operational surface too: commands in `.opencode/commands/`, prompt templates in `prompts/`, agent rules in `AGENTS.md` or `.opencode/agents/`, skills in `.opencode/skills/`, and agent operating rules in `agent-memory/` when those files control the behavior.
- If existing context is stale, correct it directly instead of leaving conflicting versions. - If existing context is stale, correct it directly instead of leaving conflicting versions.
- Promote information carefully: - Promote information carefully:
@@ -54,6 +54,8 @@ Behavior rules:
- Write canonical memory to `project-knowledge/`. - Write canonical memory to `project-knowledge/`.
- Update preexisting memory when a new prompt clarifies or corrects something already stored. - Update preexisting memory when a new prompt clarifies or corrects something already stored.
- Do not wait for a dedicated sync command if the correct memory update is already obvious. - Do not wait for a dedicated sync command if the correct memory update is already obvious.
- For analysis, drafting, review, or translation prompts, answer first and persist second unless saving the fact is required to produce the answer safely.
- Avoid creating brand-new canonical notes in the middle of a response unless the user explicitly asked for persistence or the new note is the smallest correct update.
- Do not leave behavior-only corrections only in daily logs. If a correction should affect future output, update the tool or instruction that produces that output. - Do not leave behavior-only corrections only in daily logs. If a correction should affect future output, update the tool or instruction that produces that output.
- If the memory interface or Obsidian adapter fails, continue with direct Markdown operations when safe and do not promote the failure as project memory. - If the memory interface or Obsidian adapter fails, continue with direct Markdown operations when safe and do not promote the failure as project memory.
- Do not over-promote uncertain information. Keep uncertain items in the daily log. - Do not over-promote uncertain information. Keep uncertain items in the daily log.

View File

@@ -13,33 +13,21 @@ export const FidelityCompaction = async ({ directory }) => {
return { return {
"experimental.session.compacting": async (_input, output) => { "experimental.session.compacting": async (_input, output) => {
const baseFiles = [ const baseFiles = [
"README.md",
"core/README.md",
"core/memory/operational-memory.md",
"core/integrations/memory-vault-model.md",
"core/integrations/communication-model.md",
"profiles/fidelity/profile.md", "profiles/fidelity/profile.md",
"agent-memory/README.md",
"agent-memory/behavior/agent-behavior.md", "agent-memory/behavior/agent-behavior.md",
"agent-memory/behavior/learning-sessions.md",
"agent-memory/memory/promotion-rules.md", "agent-memory/memory/promotion-rules.md",
"agent-memory/memory/context-maintenance.md",
"agent-memory/integrations/technical-verification.md", "agent-memory/integrations/technical-verification.md",
"agent-memory/workflows/workspace-model.md",
"agent-memory/workflows/ai-to-ai-prompting.md", "agent-memory/workflows/ai-to-ai-prompting.md",
"project-knowledge/00-start/start-here.md", "project-knowledge/00-start/start-here.md",
"project-knowledge/01-current/current-work.md", "project-knowledge/01-current/current-work.md",
"project-knowledge/01-current/work-items.md", "project-knowledge/01-current/work-items.md",
"project-knowledge/03-context/project.md", "project-knowledge/03-context/project.md",
"project-knowledge/03-context/ios/index.md",
"project-knowledge/03-context/ios/current-practices.md",
"project-knowledge/03-context/ios/project-swift-guidance.md",
"project-knowledge/03-context/systems/index.md",
"project-knowledge/03-context/workstreams/index.md",
"project-knowledge/03-context/process/communication.md", "project-knowledge/03-context/process/communication.md",
"project-knowledge/03-context/ios/index.md",
"project-knowledge/03-context/ios/project-swift-guidance.md",
"project-knowledge/04-people/manager.md", "project-knowledge/04-people/manager.md",
"project-knowledge/04-people/index.md", "project-knowledge/04-people/index.md",
"project-knowledge/05-decisions/rest-vs-graphql.md",
"project-knowledge/05-decisions/discourse-handling.md",
] ]
const sections = [] const sections = []
@@ -56,7 +44,7 @@ export const FidelityCompaction = async ({ directory }) => {
const logs = (await readdir(logsDir)) const logs = (await readdir(logsDir))
.filter((name) => name.endsWith(".md")) .filter((name) => name.endsWith(".md"))
.sort() .sort()
.slice(-2) .slice(-1)
for (const logName of logs) { for (const logName of logs) {
const content = await safeRead(path.join(logsDir, logName)) const content = await safeRead(path.join(logsDir, logName))

View File

@@ -9,40 +9,29 @@ OpenCode should treat this project as a persistent context layer used to:
- draft standups and Mattermost messages - draft standups and Mattermost messages
- improve communication for the current manager or stakeholder in natural professional English - improve communication for the current manager or stakeholder in natural professional English
## Always-Loaded Context ## Hot Context
The detailed operating rules live in: Keep the always-loaded context small. The hot set is:
- `project-knowledge/00-start/start-here.md` - `profiles/fidelity/profile.md`
- `agent-memory/README.md`
- `agent-memory/behavior/agent-behavior.md` - `agent-memory/behavior/agent-behavior.md`
- `agent-memory/behavior/learning-sessions.md` - `agent-memory/behavior/learning-sessions.md`
- `agent-memory/behavior/self-maintenance.md` - `agent-memory/memory/promotion-rules.md`
- `agent-memory/memory/operational-memory.md` - `agent-memory/integrations/technical-verification.md`
- `agent-memory/memory/context-maintenance.md` - `agent-memory/workflows/ai-to-ai-prompting.md`
- `agent-memory/workflows/workspace-architecture.md` - `project-knowledge/00-start/start-here.md`
- `project-knowledge/01-current/current-work.md` - `project-knowledge/01-current/current-work.md`
- `project-knowledge/01-current/work-items.md` - `project-knowledge/01-current/work-items.md`
- `project-knowledge/03-context/project.md` - `project-knowledge/03-context/project.md`
- `project-knowledge/03-context/ios/index.md`
- `project-knowledge/03-context/ios/current-practices.md`
- `project-knowledge/03-context/ios/project-swift-guidance.md`
- `project-knowledge/03-context/systems/index.md`
- `project-knowledge/03-context/workstreams/index.md`
- `project-knowledge/03-context/process/communication.md` - `project-knowledge/03-context/process/communication.md`
- `agent-memory/integrations/technical-verification.md` - `project-knowledge/03-context/ios/index.md`
- `agent-memory/workflows/ai-to-ai-prompting.md` - `project-knowledge/03-context/ios/project-swift-guidance.md`
- `agent-memory/workflows/workspace-model.md`
- `agent-memory/memory/promotion-rules.md`
- `agent-memory/integrations/memory-interface.md`
- `agent-memory/integrations/obsidian.md`
- `agent-memory/integrations/communication-sources.md`
- `core/integrations/memory-vault-model.md`
- `project-knowledge/04-people/manager.md` - `project-knowledge/04-people/manager.md`
- `project-knowledge/04-people/index.md` - `project-knowledge/04-people/index.md`
- `project-knowledge/02-work-items/index.md`
These are also loaded through `opencode.json`. Load everything else lazily when the task actually needs it.
Do not preemptively load broad context sets, all work-item files, or all process notes unless the current task clearly requires them.
## Required Behavior ## Required Behavior
@@ -53,6 +42,7 @@ These are also loaded through `opencode.json`.
- Keep Obsidian Bases clean: templates in `project-knowledge/09-templates/` must not be treated as real notes, and role mapping files such as `project-knowledge/04-people/manager.md` must not be typed as people. - Keep Obsidian Bases clean: templates in `project-knowledge/09-templates/` must not be treated as real notes, and role mapping files such as `project-knowledge/04-people/manager.md` must not be typed as people.
- Maintain useful project-note properties when editing canonical notes, especially work-item relationships (`systems`, `workstreams`, `people`, `related`) and daily note fields (`focus`, `work-items`, `blockers`). - Maintain useful project-note properties when editing canonical notes, especially work-item relationships (`systems`, `workstreams`, `people`, `related`) and daily note fields (`focus`, `work-items`, `blockers`).
- Before answering questions that depend on current work state, inspect `project-knowledge/01-current/current-work.md` and the latest relevant daily note under `project-knowledge/06-daily/`. - Before answering questions that depend on current work state, inspect `project-knowledge/01-current/current-work.md` and the latest relevant daily note under `project-knowledge/06-daily/`.
- Prefer lazy loading over eager loading. Pull in only the smallest relevant files for the active task.
- If `ai/inbox/mattermost-latest.md` exists, inspect it for fresher communication context before answering standup, status, or manager-message prompts. - If `ai/inbox/mattermost-latest.md` exists, inspect it for fresher communication context before answering standup, status, or manager-message prompts.
- If the user asks for the latest/last/recent Mattermost message, the latest message from Jeff/current manager, or what someone just said, synchronize Mattermost first instead of relying on existing inbox context. - If the user asks for the latest/last/recent Mattermost message, the latest message from Jeff/current manager, or what someone just said, synchronize Mattermost first instead of relying on existing inbox context.
- If automatic refresh is uncertain, use the explicit latest-message flow: run the Mattermost sync command, then answer from the refreshed inbox only. - If automatic refresh is uncertain, use the explicit latest-message flow: run the Mattermost sync command, then answer from the refreshed inbox only.
@@ -62,6 +52,9 @@ These are also loaded through `opencode.json`.
- Ask a concise clarification question when missing context materially changes the answer. - Ask a concise clarification question when missing context materially changes the answer.
- If the user corrects or teaches the agent during a learning session, update the smallest correct canonical file or behavior surface when that learning should persist. - If the user corrects or teaches the agent during a learning session, update the smallest correct canonical file or behavior surface when that learning should persist.
- For any meaningful prompt, decide whether the interaction introduces or corrects project memory. - For any meaningful prompt, decide whether the interaction introduces or corrects project memory.
- For analysis, review, translation, or drafting requests, answer first unless a memory update is required to avoid losing a clear durable fact.
- Do not create new canonical notes before answering unless the user asked to save the information, the destination is obvious, and the write is small and non-blocking.
- Prefer updating existing canonical files over creating new files during the critical path of a user-facing answer.
- If a sync command, extraction script, or inbox refresh fails, do not update logs, state, or context files from that failed attempt. - If a sync command, extraction script, or inbox refresh fails, do not update logs, state, or context files from that failed attempt.
- Treat sync failures as operational errors, not project context. - Treat sync failures as operational errors, not project context.
- `mattermost-sync` should automatically promote high-confidence project facts without asking what to promote. - `mattermost-sync` should automatically promote high-confidence project facts without asking what to promote.
@@ -76,6 +69,7 @@ These are also loaded through `opencode.json`.
- If a new prompt corrects prior understanding, update the canonical file directly instead of keeping both versions alive. - If a new prompt corrects prior understanding, update the canonical file directly instead of keeping both versions alive.
- Do not ask what should be saved when the correct destination is already clear. - Do not ask what should be saved when the correct destination is already clear.
- If the user provides durable new facts, update the appropriate context files instead of leaving the new information only in chat history. - If the user provides durable new facts, update the appropriate context files instead of leaving the new information only in chat history.
- When the prompt is primarily asking for analysis of a screenshot, message, or document, do not interrupt the answer to perform proactive note creation unless that persistence is the explicit goal.
- When creating a new canonical note from a known type, prefer `scripts/memory/memory.sh create <type> <slug> [title]` so type-to-folder routing stays centralized. - When creating a new canonical note from a known type, prefer `scripts/memory/memory.sh create <type> <slug> [title]` so type-to-folder routing stays centralized.
- If the Obsidian CLI adapter fails, fall back to direct Markdown operations and treat the failure as tooling status, not project context. - If the Obsidian CLI adapter fails, fall back to direct Markdown operations and treat the failure as tooling status, not project context.
- If a previous context file is now stale or inaccurate, update that file directly. - If a previous context file is now stale or inaccurate, update that file directly.

View File

@@ -15,7 +15,7 @@ Make workspace memory maintenance part of the agent's normal job, not a separate
## Default Agent Behavior (Real-Time Auto-Documentation) ## Default Agent Behavior (Real-Time Auto-Documentation)
For EVERY meaningful prompt, the agent MUST execute a real-time auto-documentation loop. It is not an optional workflow; it is the core of the agent's job. For every meaningful prompt, the agent must evaluate whether a memory update is needed in the same turn. Auto-documentation is part of the job, but it must not dominate the critical path of simple user-facing answers.
This applies to: This applies to:
@@ -27,10 +27,13 @@ This applies to:
- debugging discussions - debugging discussions
- corrections to previous understanding - corrections to previous understanding
The agent MUST NOT wait for a separate promotion command. The agent MUST proactively use file editing tools to update `project-knowledge/` (including 01-current, 02-work-items, 03-context, 04-people, 06-daily) within the SAME conversational turn if new information is detected or if prior context becomes stale. The agent must not wait for a separate promotion command. The agent should proactively update `project-knowledge/` (including 01-current, 02-work-items, 03-context, 04-people, 06-daily) within the same conversational turn when new information is clear, durable, and the destination is obvious.
- When editing `project-knowledge/`, write as a human engineer maintaining shared project documentation. - When editing `project-knowledge/`, write as a human engineer maintaining shared project documentation.
- Keep agent-operating logic out of `project-knowledge/`; store that logic in prompts, commands, skills, agents, or `agent-memory/`. - Keep agent-operating logic out of `project-knowledge/`; store that logic in prompts, commands, skills, agents, or `agent-memory/`.
- Answer-first rule: when the user's main goal is analysis, review, translation, or drafting, answer first unless persistence is required to avoid losing a clear durable fact.
- Do not create a brand-new canonical note during the critical path of the answer unless the user explicitly asked to save the fact or the new note is the smallest correct update.
- Prefer updating an existing canonical note over creating a new file when both are valid.
--- ---

View File

@@ -2,6 +2,16 @@
"$schema": "https://opencode.ai/config.json", "$schema": "https://opencode.ai/config.json",
"default_agent": "fidelity", "default_agent": "fidelity",
"share": "manual", "share": "manual",
"snapshot": false,
"watcher": {
"ignore": [
".git/**",
"archives/**",
".opencode/node_modules/**",
"scripts/*/generated/**",
"project-knowledge/attachments/**"
]
},
"mcp": { "mcp": {
"obsidian": { "obsidian": {
"type": "local", "type": "local",
@@ -53,51 +63,20 @@
"doom_loop": "ask" "doom_loop": "ask"
}, },
"instructions": [ "instructions": [
"./README.md",
"./core/README.md",
"./core/memory/operational-memory.md",
"./core/integrations/memory-vault-model.md",
"./core/integrations/communication-model.md",
"./core/integrations/obsidian-model.md",
"./core/profiles/create-project-profile.md",
"./profiles/fidelity/profile.md", "./profiles/fidelity/profile.md",
"./agent-memory/README.md",
"./agent-memory/behavior/agent-behavior.md", "./agent-memory/behavior/agent-behavior.md",
"./agent-memory/behavior/learning-sessions.md", "./agent-memory/behavior/learning-sessions.md",
"./agent-memory/behavior/self-maintenance.md",
"./agent-memory/memory/operational-memory.md",
"./agent-memory/memory/promotion-rules.md", "./agent-memory/memory/promotion-rules.md",
"./agent-memory/memory/context-maintenance.md",
"./agent-memory/integrations/memory-interface.md",
"./agent-memory/integrations/obsidian.md",
"./agent-memory/integrations/communication-sources.md",
"./agent-memory/integrations/technical-verification.md", "./agent-memory/integrations/technical-verification.md",
"./agent-memory/workflows/ai-to-ai-prompting.md", "./agent-memory/workflows/ai-to-ai-prompting.md",
"./agent-memory/workflows/workspace-model.md",
"./agent-memory/workflows/workspace-architecture.md",
"./project-knowledge/00-start/start-here.md", "./project-knowledge/00-start/start-here.md",
"./project-knowledge/00-start/onboarding.md",
"./project-knowledge/00-start/glossary.md",
"./project-knowledge/01-current/current-work.md", "./project-knowledge/01-current/current-work.md",
"./project-knowledge/01-current/work-items.md", "./project-knowledge/01-current/work-items.md",
"./project-knowledge/07-maps/current-work.md",
"./project-knowledge/07-maps/fidelity-domain.md",
"./project-knowledge/07-maps/work-items.md",
"./project-knowledge/07-maps/people.md",
"./project-knowledge/03-context/project.md", "./project-knowledge/03-context/project.md",
"./project-knowledge/03-context/process/communication.md", "./project-knowledge/03-context/process/communication.md",
"./project-knowledge/03-context/process/jira-story-rules.md",
"./project-knowledge/03-context/process/communication-rules.md",
"./project-knowledge/03-context/process/pull-requests.md",
"./project-knowledge/03-context/ios/index.md", "./project-knowledge/03-context/ios/index.md",
"./project-knowledge/03-context/ios/current-practices.md",
"./project-knowledge/03-context/ios/project-swift-guidance.md", "./project-knowledge/03-context/ios/project-swift-guidance.md",
"./project-knowledge/03-context/systems/index.md",
"./project-knowledge/03-context/workstreams/index.md",
"./project-knowledge/03-context/workstreams/flow-page-references.md",
"./project-knowledge/04-people/manager.md", "./project-knowledge/04-people/manager.md",
"./project-knowledge/04-people/index.md", "./project-knowledge/04-people/index.md"
"./project-knowledge/05-decisions/rest-vs-graphql.md",
"./project-knowledge/05-decisions/discourse-handling.md"
] ]
} }