Files
fidelity-ai-workspace/.opencode/plugins/fidelity-compaction.js
david.delagneau 374991a568 Refactor workspace structure and documentation
- Deleted obsolete files: obsidian-vault.md, onboarding.md, workspace-model.md
- Updated opencode.json to remove references to deleted files.
- Revised profile.md to clarify the status of legacy paths and communication evidence.
- Adjusted prompts to reflect new file paths and improve clarity.
- Enhanced daily logs with focus, work-items, and blockers properties.
- Updated work-item notes to include systems, workstreams, people, and related properties.
- Improved context maintenance guidelines to ensure accurate and durable project knowledge.
- Refined base filters to exclude template files and ensure only relevant notes are displayed.
- Updated daily templates to ensure proper formatting and consistency.
- Modified workflows to align with the new vault structure and improve context synchronization.
2026-04-16 16:28:30 -06:00

78 lines
2.4 KiB
JavaScript

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",
"core/README.md",
"core/memory/operational-memory.md",
"core/integrations/communication-model.md",
"profiles/fidelity/profile.md",
"vault/00-start/start-here.md",
"vault/01-current/current-work.md",
"vault/01-current/work-items.md",
"vault/03-context/project.md",
"vault/03-context/ios/index.md",
"vault/03-context/ios/current-practices.md",
"vault/03-context/ios/project-swift-guidance.md",
"vault/03-context/systems/index.md",
"vault/03-context/workstreams/index.md",
"vault/03-context/process/communication.md",
"vault/03-context/process/ai-to-ai-prompting.md",
"vault/04-people/manager.md",
"vault/04-people/index.md",
"vault/05-decisions/rest-vs-graphql.md",
"vault/05-decisions/discourse-handling.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, "vault/06-daily")
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(`### vault/06-daily/${logName}\n${content.trim()}`)
}
}
} catch {
// No logs available yet.
}
if (sections.length > 0) {
output.context.push(
[
"## AI 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"),
)
}
},
}
}