Skip to content

feat(server): add builtin past-conversations skill#796

Open
caoergou wants to merge 6 commits intodifferent-ai:devfrom
caoergou:feat/builtin-past-conversations-skill
Open

feat(server): add builtin past-conversations skill#796
caoergou wants to merge 6 commits intodifferent-ai:devfrom
caoergou:feat/builtin-past-conversations-skill

Conversation

@caoergou
Copy link
Contributor

@caoergou caoergou commented Mar 8, 2026

Summary

Add a builtin past-conversations skill that allows the AI to recall previous conversations from the OpenCode SQLite database.

Changes

  • Add packages/server/src/builtin-skills/past-conversations/SKILL.md
  • Modify listSkills() to include builtin skills with fallback mechanism
  • Add getSkillContent() for reading skill content from filesystem or embedded module
  • Add script/generate-builtin-skills.ts for single-file executable support
  • Add script/copy-builtin-skills.ts for npm package distribution
  • Add trigger phrases in skill description for AI routing
  • Add test coverage for builtin skills functionality

Technical Details

Build Process

Two build modes are supported:

  1. Normal build (bun run build): Uses tsc + copy script to include SKILL.md files in dist/
  2. Single-file executable (bun run build:bin): Generates TypeScript module with embedded skill content

Single Source of Truth

All skill content lives in SKILL.md files. The generated TypeScript module is created during build and should not be committed to git.

Test Plan

  • All 115 tests pass
  • TypeScript typecheck passes
  • Build scripts work correctly
  • Manual testing: skill appears in skills list
  • Manual testing: skill can query past conversations

Closes #792

@vercel
Copy link

vercel bot commented Mar 8, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
openwork-software Ready Ready Preview, Comment Mar 8, 2026 1:16pm

@vercel
Copy link

vercel bot commented Mar 8, 2026

@caoergou is attempting to deploy a commit to the 0 Finance Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 8, 2026

The following comment was made by an LLM, it may be inaccurate:

caoergou added 4 commits March 8, 2026 20:56
Add a default skill for recalling previous conversations from the
OpenCode SQLite database.

- Add builtin-skills directory with past-conversations/SKILL.md
- Modify listSkills() to include builtin skills with fallback mechanism
- Add getSkillContent() for reading skill content from filesystem or
  embedded module (handles builtin:// protocol paths)
- Update server.ts to use getSkillContent() for skill content retrieval

The implementation supports two build modes:
- Normal build: reads SKILL.md files from filesystem
- Single-file executable: uses generated module with embedded content

Closes different-ai#792
Add scripts to support both build modes:

- copy-builtin-skills.ts: copies SKILL.md files to dist/ for npm package
- generate-builtin-skills.ts: generates TypeScript module for single-file
  executable with embedded skill content

Both scripts handle edge cases gracefully (missing directories, empty
skill lists).

Update build scripts in package.json:
- build: runs copy script after tsc
- build:bin: runs generate script before compile
- build:bin:all: runs generate script before multi-platform build
Add tests for:
- listSkills returns builtin skills
- past-conversations skill exists with correct properties
- Trigger phrases are present in description
- Skill path points to builtin directory
- getSkillContent returns content for builtin skill
The generated-builtin-skills.ts is auto-generated by the build script
and should not be version controlled.
- Add `builtin: boolean` field to SkillItem type for clear identification
- Unify path format to `builtin://<name>` for all builtin skills
- Improve getSkillContent error handling with explicit error message
- Add filesystem fallback in getSkillContent for better robustness
- Add check in deleteSkill to reject deletion of builtin skills
- Return specific error code "cannot_delete_builtin_skill"
- Add tests for:
  - Attempting to delete builtin skill throws appropriate error
  - Project skills can override builtin skills (project takes precedence)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add default past-conversations skill for recalling previous chats

1 participant