mirror of
https://github.com/fscotto/infra.git
synced 2026-05-30 15:39:58 +00:00
Reorganize OpenCode context initialization
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -25,6 +25,6 @@ common → OS → profile → host
|
||||
|
||||
## Agent Behavior
|
||||
- make minimal changes
|
||||
- avoid refactors
|
||||
- avoid unnecessary refactors
|
||||
- preserve architecture
|
||||
- never break existing systems
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
# infra.md
|
||||
|
||||
Layering:
|
||||
common → OS → profile → host
|
||||
|
||||
Rules:
|
||||
- no host logic in shared layers
|
||||
- reuse over duplication
|
||||
- incremental evolution
|
||||
@@ -0,0 +1,7 @@
|
||||
# Architecture
|
||||
|
||||
core system → user environment
|
||||
|
||||
- Keep separation strict
|
||||
- Avoid mixing concerns
|
||||
- Systems must remain understandable
|
||||
5
dotfiles/desktop/.config/opencode/knowledge/cli.md
Normal file
5
dotfiles/desktop/.config/opencode/knowledge/cli.md
Normal file
@@ -0,0 +1,5 @@
|
||||
# CLI
|
||||
|
||||
- Bash + tmux + fzf
|
||||
- Keyboard-driven workflow
|
||||
- Minimal and efficient
|
||||
5
dotfiles/desktop/.config/opencode/knowledge/desktop.md
Normal file
5
dotfiles/desktop/.config/opencode/knowledge/desktop.md
Normal file
@@ -0,0 +1,5 @@
|
||||
# Desktop
|
||||
|
||||
- i3 primary
|
||||
- XFCE components selectively
|
||||
- Hyprland experimental
|
||||
5
dotfiles/desktop/.config/opencode/knowledge/dotfiles.md
Normal file
5
dotfiles/desktop/.config/opencode/knowledge/dotfiles.md
Normal file
@@ -0,0 +1,5 @@
|
||||
# Dotfiles
|
||||
|
||||
- Managed via stow
|
||||
- Layering: common → profile → host
|
||||
- Must remain portable
|
||||
5
dotfiles/desktop/.config/opencode/knowledge/emacs.md
Normal file
5
dotfiles/desktop/.config/opencode/knowledge/emacs.md
Normal file
@@ -0,0 +1,5 @@
|
||||
# Emacs
|
||||
|
||||
- Primary editor
|
||||
- LSP for C, Go, Python
|
||||
- Modular configuration
|
||||
6
dotfiles/desktop/.config/opencode/knowledge/infra.md
Normal file
6
dotfiles/desktop/.config/opencode/knowledge/infra.md
Normal file
@@ -0,0 +1,6 @@
|
||||
# Infrastructure
|
||||
|
||||
- Tool: Ansible
|
||||
- Layering: common → OS → profile → host
|
||||
- Idempotency is mandatory
|
||||
- Single-host validation before rollout
|
||||
5
dotfiles/desktop/.config/opencode/knowledge/kernel.md
Normal file
5
dotfiles/desktop/.config/opencode/knowledge/kernel.md
Normal file
@@ -0,0 +1,5 @@
|
||||
# Kernel
|
||||
|
||||
- Learning kernel modules
|
||||
- Debugging with GDB
|
||||
- Understanding internals
|
||||
13
dotfiles/desktop/.config/opencode/knowledge/os_setup.md
Normal file
13
dotfiles/desktop/.config/opencode/knowledge/os_setup.md
Normal file
@@ -0,0 +1,13 @@
|
||||
# OS Setup
|
||||
|
||||
- Preferred:
|
||||
- Arch (reference)
|
||||
- Void (minimal)
|
||||
- Debian/Ubuntu (work)
|
||||
|
||||
- Disk:
|
||||
- EFI + LUKS2 + btrfs
|
||||
|
||||
- Init:
|
||||
- runit (Void)
|
||||
- systemd (others)
|
||||
@@ -0,0 +1,6 @@
|
||||
# Philosophy
|
||||
|
||||
- UNIX
|
||||
- Minimalism
|
||||
- Reproducibility
|
||||
- Control over convenience
|
||||
5
dotfiles/desktop/.config/opencode/knowledge/server.md
Normal file
5
dotfiles/desktop/.config/opencode/knowledge/server.md
Normal file
@@ -0,0 +1,5 @@
|
||||
# Server
|
||||
|
||||
- Ubuntu minimal server
|
||||
- Self-hosting services
|
||||
- Low attack surface
|
||||
@@ -0,0 +1,5 @@
|
||||
# System Programming
|
||||
|
||||
- Language: C
|
||||
- Focus: UNIX APIs
|
||||
- Practice: small tools and exercises
|
||||
@@ -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"
|
||||
]
|
||||
}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
# Ansible Role Pattern
|
||||
|
||||
- Create roles for reusable logic
|
||||
- Keep structure clean
|
||||
- Use handlers for services
|
||||
@@ -0,0 +1,5 @@
|
||||
# Dotfiles Layering Pattern
|
||||
|
||||
common → profile → host
|
||||
|
||||
Avoid duplication and keep overrides minimal
|
||||
@@ -0,0 +1,8 @@
|
||||
# Project Structure Pattern
|
||||
|
||||
infra/
|
||||
ansible/
|
||||
dotfiles/
|
||||
scripts/
|
||||
|
||||
Keep structure predictable
|
||||
@@ -0,0 +1,5 @@
|
||||
# Service Setup Pattern
|
||||
|
||||
- Define service
|
||||
- Enable via init system
|
||||
- Use handler for restart
|
||||
@@ -1,6 +0,0 @@
|
||||
# philosophy.md
|
||||
|
||||
- UNIX first
|
||||
- simple > complex
|
||||
- explicit > implicit
|
||||
- control > convenience
|
||||
6
dotfiles/desktop/.config/opencode/rules/ansible.md
Normal file
6
dotfiles/desktop/.config/opencode/rules/ansible.md
Normal file
@@ -0,0 +1,6 @@
|
||||
# Ansible Rules
|
||||
|
||||
- Prefer modules over shell
|
||||
- Keep tasks idempotent
|
||||
- Use group_vars and host_vars properly
|
||||
- Avoid duplication
|
||||
5
dotfiles/desktop/.config/opencode/rules/dotfiles.md
Normal file
5
dotfiles/desktop/.config/opencode/rules/dotfiles.md
Normal file
@@ -0,0 +1,5 @@
|
||||
# Dotfiles Rules
|
||||
|
||||
- No system logic inside dotfiles
|
||||
- Keep them portable
|
||||
- Follow layering
|
||||
8
dotfiles/desktop/.config/opencode/rules/safety.md
Normal file
8
dotfiles/desktop/.config/opencode/rules/safety.md
Normal 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
|
||||
5
dotfiles/desktop/.config/opencode/rules/workflow.md
Normal file
5
dotfiles/desktop/.config/opencode/rules/workflow.md
Normal file
@@ -0,0 +1,5 @@
|
||||
# Workflow Rules
|
||||
|
||||
- Small incremental changes
|
||||
- Validate on one host
|
||||
- Expand gradually
|
||||
@@ -1,6 +0,0 @@
|
||||
# workflow.md
|
||||
|
||||
- small changes
|
||||
- test on one host
|
||||
- use dry-run (--check --diff)
|
||||
- keep idempotency
|
||||
Reference in New Issue
Block a user