Reorganize OpenCode context initialization

This commit is contained in:
Fabio Scotto di Santolo
2026-04-03 17:06:13 +02:00
parent 6681ac199f
commit 52b9b850ed
25 changed files with 125 additions and 26 deletions

View File

@@ -1,7 +1,15 @@
# AGENTS.md — Global Context
Rules:
Always follow:
- minimal, targeted edits
- preserve layering
- avoid duplication
- validate before applying changes
Task-specific file loading:
- For infra or Ansible work, read `~/.config/opencode/knowledge/infra.md` and `~/.config/opencode/rules/ansible.md`
- For desktop work, read `~/.config/opencode/knowledge/desktop.md`
- For dotfiles work, read `~/.config/opencode/knowledge/dotfiles.md` and `~/.config/opencode/patterns/dotfiles_layering.md`
- For system programming work, read `~/.config/opencode/knowledge/system_programming.md`
Do not preemptively load all task-specific files. Load only the files relevant to the current task.

View File

@@ -25,6 +25,6 @@ common → OS → profile → host
## Agent Behavior
- make minimal changes
- avoid refactors
- avoid unnecessary refactors
- preserve architecture
- never break existing systems

View File

@@ -1,9 +0,0 @@
# infra.md
Layering:
common → OS → profile → host
Rules:
- no host logic in shared layers
- reuse over duplication
- incremental evolution

View File

@@ -0,0 +1,7 @@
# Architecture
core system → user environment
- Keep separation strict
- Avoid mixing concerns
- Systems must remain understandable

View File

@@ -0,0 +1,5 @@
# CLI
- Bash + tmux + fzf
- Keyboard-driven workflow
- Minimal and efficient

View File

@@ -0,0 +1,5 @@
# Desktop
- i3 primary
- XFCE components selectively
- Hyprland experimental

View File

@@ -0,0 +1,5 @@
# Dotfiles
- Managed via stow
- Layering: common → profile → host
- Must remain portable

View File

@@ -0,0 +1,5 @@
# Emacs
- Primary editor
- LSP for C, Go, Python
- Modular configuration

View File

@@ -0,0 +1,6 @@
# Infrastructure
- Tool: Ansible
- Layering: common → OS → profile → host
- Idempotency is mandatory
- Single-host validation before rollout

View File

@@ -0,0 +1,5 @@
# Kernel
- Learning kernel modules
- Debugging with GDB
- Understanding internals

View File

@@ -0,0 +1,13 @@
# OS Setup
- Preferred:
- Arch (reference)
- Void (minimal)
- Debian/Ubuntu (work)
- Disk:
- EFI + LUKS2 + btrfs
- Init:
- runit (Void)
- systemd (others)

View File

@@ -0,0 +1,6 @@
# Philosophy
- UNIX
- Minimalism
- Reproducibility
- Control over convenience

View File

@@ -0,0 +1,5 @@
# Server
- Ubuntu minimal server
- Self-hosting services
- Low attack surface

View File

@@ -0,0 +1,5 @@
# System Programming
- Language: C
- Focus: UNIX APIs
- Practice: small tools and exercises

View File

@@ -2,8 +2,6 @@
"$schema": "https://opencode.ai/config.json",
"instructions": [
"~/.config/opencode/bootstrap.md",
"~/.config/opencode/infra.md",
"~/.config/opencode/philosophy.md",
"~/.config/opencode/workflow.md"
"~/.config/opencode/rules/safety.md"
]
}

View File

@@ -0,0 +1,5 @@
# Ansible Role Pattern
- Create roles for reusable logic
- Keep structure clean
- Use handlers for services

View File

@@ -0,0 +1,5 @@
# Dotfiles Layering Pattern
common → profile → host
Avoid duplication and keep overrides minimal

View File

@@ -0,0 +1,8 @@
# Project Structure Pattern
infra/
ansible/
dotfiles/
scripts/
Keep structure predictable

View File

@@ -0,0 +1,5 @@
# Service Setup Pattern
- Define service
- Enable via init system
- Use handler for restart

View File

@@ -1,6 +0,0 @@
# philosophy.md
- UNIX first
- simple > complex
- explicit > implicit
- control > convenience

View File

@@ -0,0 +1,6 @@
# Ansible Rules
- Prefer modules over shell
- Keep tasks idempotent
- Use group_vars and host_vars properly
- Avoid duplication

View File

@@ -0,0 +1,5 @@
# Dotfiles Rules
- No system logic inside dotfiles
- Keep them portable
- Follow layering

View File

@@ -0,0 +1,8 @@
# Safety Rules
Never break an existing host.
- Identify host, layer, risk
- Always test with --limit
- Use dry-run (--check --diff)
- Avoid destructive changes

View File

@@ -0,0 +1,5 @@
# Workflow Rules
- Small incremental changes
- Validate on one host
- Expand gradually

View File

@@ -1,6 +0,0 @@
# workflow.md
- small changes
- test on one host
- use dry-run (--check --diff)
- keep idempotency