feat: Add Fidelity workspace agent and context management commands
- Introduced a primary agent for the Fidelity AI Workspace to maintain context and support daily engineering tasks. - Created commands for loading workspace context, drafting updates for Jeff, and logging daily notes. - Implemented translation and standup generation commands to enhance communication clarity. - Developed a compaction plugin to preserve essential workspace context during sessions. - Established a structured approach for managing project knowledge, communication rules, and decision-making processes. - Updated README and project structure to reflect new workflows and usage guidelines.
This commit is contained in:
24
.opencode/agents/fidelity.md
Normal file
24
.opencode/agents/fidelity.md
Normal file
@@ -0,0 +1,24 @@
|
||||
---
|
||||
description: Fidelity workspace agent for context-aware daily engineering support
|
||||
mode: primary
|
||||
temperature: 0.1
|
||||
---
|
||||
|
||||
You are the primary OpenCode agent for the Fidelity AI Workspace.
|
||||
|
||||
Your job is not only to answer prompts, but to keep the workspace context accurate over time.
|
||||
|
||||
Behavior rules:
|
||||
|
||||
- Treat `README.md`, `ai/context/`, `ai/state/`, `knowledge/`, and `ai/logs/` as the persistent memory of the project.
|
||||
- Before answering a prompt that depends on current state, verify the latest relevant files instead of relying only on conversation history.
|
||||
- When the user provides new durable information, update the right workspace files before or while answering.
|
||||
- If existing context is stale, correct it directly instead of leaving conflicting versions.
|
||||
- Promote information carefully:
|
||||
- daily facts go to `ai/logs/YYYY-MM-DD.md`
|
||||
- current priorities go to `ai/state/current.md`
|
||||
- durable project knowledge goes to `ai/context/project.md`
|
||||
- confirmed team or manager communication preferences go to `ai/context/people/jeff.md`
|
||||
- confirmed decisions go to `ai/context/decisions/`
|
||||
- Do not over-promote uncertain information. Keep uncertain items in the daily log.
|
||||
- When drafting communication, preserve technical meaning and improve clarity in natural US English.
|
||||
37
.opencode/commands/fidelity-context.md
Normal file
37
.opencode/commands/fidelity-context.md
Normal file
@@ -0,0 +1,37 @@
|
||||
---
|
||||
description: Load Fidelity workspace context for the current session
|
||||
---
|
||||
|
||||
Load and internalize the active context for this Fidelity workspace before answering any follow-up questions today.
|
||||
|
||||
Use these files as the baseline context:
|
||||
|
||||
@README.md
|
||||
@ai/AGENTS.md
|
||||
@ai/context/project.md
|
||||
@ai/context/people/jeff.md
|
||||
@ai/state/current.md
|
||||
@ai/context/decisions/rest-vs-graphql.md
|
||||
@ai/context/decisions/discourse-handling.md
|
||||
@knowledge/workspace-model.md
|
||||
@knowledge/communication-rules.md
|
||||
|
||||
Today's date:
|
||||
|
||||
!`date +%F`
|
||||
|
||||
Today's log, if present:
|
||||
|
||||
!`if [ -f ai/logs/$(date +%F).md ]; then cat ai/logs/$(date +%F).md; else echo "No log exists for today yet."; fi`
|
||||
|
||||
Recent logs available:
|
||||
|
||||
!`ls -1 ai/logs 2>/dev/null | sort | tail -n 5`
|
||||
|
||||
Respond with:
|
||||
|
||||
1. Current context
|
||||
2. Communication risks
|
||||
3. Missing context to capture today
|
||||
|
||||
Keep the response concise, then wait for the next request.
|
||||
36
.opencode/commands/jeff-update.md
Normal file
36
.opencode/commands/jeff-update.md
Normal file
@@ -0,0 +1,36 @@
|
||||
---
|
||||
description: Draft or polish a Mattermost update for Jeff
|
||||
---
|
||||
|
||||
Draft a concise Mattermost message for Jeff in natural US English.
|
||||
|
||||
Read:
|
||||
|
||||
@prompts/manager-update.md
|
||||
@ai/AGENTS.md
|
||||
@ai/context/project.md
|
||||
@ai/context/people/jeff.md
|
||||
@ai/state/current.md
|
||||
@knowledge/communication-rules.md
|
||||
|
||||
Today's log, if present:
|
||||
|
||||
!`if [ -f ai/logs/$(date +%F).md ]; then cat ai/logs/$(date +%F).md; else echo "No log exists for today yet."; fi`
|
||||
|
||||
User draft or rough notes:
|
||||
|
||||
$ARGUMENTS
|
||||
|
||||
Requirements:
|
||||
|
||||
- Use Context, Observation, Action
|
||||
- Clarify scope
|
||||
- Preserve technical meaning
|
||||
- Mention auth state when relevant
|
||||
- Do not label something a regression unless the context supports it
|
||||
- Keep the result short enough for Mattermost
|
||||
|
||||
Return:
|
||||
|
||||
1. Final message
|
||||
2. One-line note with any assumption you had to make
|
||||
33
.opencode/commands/log-note.md
Normal file
33
.opencode/commands/log-note.md
Normal file
@@ -0,0 +1,33 @@
|
||||
---
|
||||
description: Update today's log from rough notes or Mattermost context
|
||||
---
|
||||
|
||||
Use this workspace as the source of truth for daily context maintenance.
|
||||
|
||||
Read:
|
||||
|
||||
@README.md
|
||||
@ai/AGENTS.md
|
||||
@ai/context/project.md
|
||||
@ai/state/current.md
|
||||
|
||||
Today's existing log, if present:
|
||||
|
||||
!`if [ -f ai/logs/$(date +%F).md ]; then cat ai/logs/$(date +%F).md; else echo "No log exists for today yet."; fi`
|
||||
|
||||
Incorporate these new rough notes into today's log:
|
||||
|
||||
$ARGUMENTS
|
||||
|
||||
Instructions:
|
||||
|
||||
- Update or create `ai/logs/$(date +%F).md`
|
||||
- Preserve concrete technical meaning
|
||||
- Capture both technical findings and communication context when relevant
|
||||
- Keep the log concise but reusable for later standups and manager updates
|
||||
- If the notes are ambiguous, normalize them without inventing facts
|
||||
|
||||
After editing, respond with:
|
||||
|
||||
1. What was added or clarified
|
||||
2. Any missing context still worth capturing
|
||||
23
.opencode/commands/mattermost-translate.md
Normal file
23
.opencode/commands/mattermost-translate.md
Normal file
@@ -0,0 +1,23 @@
|
||||
---
|
||||
description: Translate rough Spanish engineering notes into Mattermost-ready English
|
||||
---
|
||||
|
||||
Translate and tighten the following rough notes for Mattermost:
|
||||
|
||||
$ARGUMENTS
|
||||
|
||||
Read:
|
||||
|
||||
@prompts/mattermost-translation.md
|
||||
@ai/AGENTS.md
|
||||
@ai/context/people/jeff.md
|
||||
@knowledge/communication-rules.md
|
||||
|
||||
If relevant, use today's log for context:
|
||||
|
||||
!`if [ -f ai/logs/$(date +%F).md ]; then cat ai/logs/$(date +%F).md; else echo "No log exists for today yet."; fi`
|
||||
|
||||
Return:
|
||||
|
||||
1. Clean message
|
||||
2. Short assumptions note
|
||||
28
.opencode/commands/standup.md
Normal file
28
.opencode/commands/standup.md
Normal file
@@ -0,0 +1,28 @@
|
||||
---
|
||||
description: Draft a standup from the latest Fidelity workspace context
|
||||
---
|
||||
|
||||
Generate a standup update using the latest workspace state.
|
||||
|
||||
Read:
|
||||
|
||||
@prompts/standup.md
|
||||
@ai/AGENTS.md
|
||||
@ai/context/project.md
|
||||
@ai/state/current.md
|
||||
@knowledge/communication-rules.md
|
||||
|
||||
Today's log, if present:
|
||||
|
||||
!`if [ -f ai/logs/$(date +%F).md ]; then cat ai/logs/$(date +%F).md; else echo "No log exists for today yet."; fi`
|
||||
|
||||
If no log exists for today, also inspect the most recent previous log:
|
||||
|
||||
!`latest=$(ls -1 ai/logs 2>/dev/null | sort | tail -n 1); if [ -n "$latest" ]; then echo "$latest"; cat "ai/logs/$latest"; else echo "No logs available."; fi`
|
||||
|
||||
Return a standup that is:
|
||||
|
||||
- specific
|
||||
- concise
|
||||
- grounded in the latest context
|
||||
- safe to send without overstating certainty
|
||||
42
.opencode/commands/sync-context.md
Normal file
42
.opencode/commands/sync-context.md
Normal file
@@ -0,0 +1,42 @@
|
||||
---
|
||||
description: Update workspace memory from new facts, corrections, or Mattermost notes
|
||||
---
|
||||
|
||||
Use this command when new information should become part of the persistent workspace context.
|
||||
|
||||
Read:
|
||||
|
||||
@README.md
|
||||
@ai/AGENTS.md
|
||||
@ai/context/project.md
|
||||
@ai/context/people/jeff.md
|
||||
@ai/state/current.md
|
||||
@knowledge/workspace-model.md
|
||||
@knowledge/communication-rules.md
|
||||
|
||||
Today's existing log, if present:
|
||||
|
||||
!`if [ -f ai/logs/$(date +%F).md ]; then cat ai/logs/$(date +%F).md; else echo "No log exists for today yet."; fi`
|
||||
|
||||
New information to incorporate:
|
||||
|
||||
$ARGUMENTS
|
||||
|
||||
Instructions:
|
||||
|
||||
- Decide whether the new information belongs in:
|
||||
- today's log
|
||||
- `ai/state/current.md`
|
||||
- `ai/context/project.md`
|
||||
- `ai/context/people/jeff.md`
|
||||
- `ai/context/decisions/`
|
||||
- Update the appropriate files directly
|
||||
- If an existing statement became stale, replace or refine it
|
||||
- Do not invent missing facts
|
||||
- Keep uncertain information in the daily log instead of promoting it to stable context
|
||||
|
||||
After editing, respond with:
|
||||
|
||||
1. Updated files
|
||||
2. What changed in the persistent context
|
||||
3. Any uncertainty that remains
|
||||
24
.opencode/commands/translate.md
Normal file
24
.opencode/commands/translate.md
Normal file
@@ -0,0 +1,24 @@
|
||||
---
|
||||
description: Alias for Mattermost-ready translation and polishing
|
||||
---
|
||||
|
||||
Translate and tighten the following rough notes into concise Mattermost-ready English:
|
||||
|
||||
$ARGUMENTS
|
||||
|
||||
Read:
|
||||
|
||||
@prompts/mattermost-translation.md
|
||||
@ai/AGENTS.md
|
||||
@ai/context/project.md
|
||||
@ai/context/people/jeff.md
|
||||
@knowledge/communication-rules.md
|
||||
|
||||
If relevant, use today's log for context:
|
||||
|
||||
!`if [ -f ai/logs/$(date +%F).md ]; then cat ai/logs/$(date +%F).md; else echo "No log exists for today yet."; fi`
|
||||
|
||||
Return:
|
||||
|
||||
1. Clean message
|
||||
2. Short assumptions note
|
||||
65
.opencode/plugins/fidelity-compaction.js
Normal file
65
.opencode/plugins/fidelity-compaction.js
Normal file
@@ -0,0 +1,65 @@
|
||||
import { readdir, readFile } from "node:fs/promises"
|
||||
import path from "node:path"
|
||||
|
||||
async function safeRead(filePath) {
|
||||
try {
|
||||
return await readFile(filePath, "utf8")
|
||||
} catch {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
export const FidelityCompaction = async ({ directory }) => {
|
||||
return {
|
||||
"experimental.session.compacting": async (_input, output) => {
|
||||
const baseFiles = [
|
||||
"README.md",
|
||||
"ai/context/project.md",
|
||||
"ai/context/people/jeff.md",
|
||||
"ai/state/current.md",
|
||||
"ai/context/decisions/rest-vs-graphql.md",
|
||||
"ai/context/decisions/discourse-handling.md",
|
||||
"knowledge/workspace-model.md",
|
||||
"knowledge/communication-rules.md",
|
||||
]
|
||||
|
||||
const sections = []
|
||||
|
||||
for (const relPath of baseFiles) {
|
||||
const content = await safeRead(path.join(directory, relPath))
|
||||
if (content) {
|
||||
sections.push(`### ${relPath}\n${content.trim()}`)
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
const logsDir = path.join(directory, "ai/logs")
|
||||
const logs = (await readdir(logsDir))
|
||||
.filter((name) => name.endsWith(".md"))
|
||||
.sort()
|
||||
.slice(-2)
|
||||
|
||||
for (const logName of logs) {
|
||||
const content = await safeRead(path.join(logsDir, logName))
|
||||
if (content) {
|
||||
sections.push(`### ai/logs/${logName}\n${content.trim()}`)
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
// No logs available yet.
|
||||
}
|
||||
|
||||
if (sections.length > 0) {
|
||||
output.context.push(
|
||||
[
|
||||
"## Fidelity Workspace Persistent Context",
|
||||
"Preserve this operational memory across compaction.",
|
||||
"If later messages introduced corrections or durable facts, prefer the corrected view over stale summaries.",
|
||||
"",
|
||||
sections.join("\n\n"),
|
||||
].join("\n"),
|
||||
)
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user