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:
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