Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
164 changes: 164 additions & 0 deletions .opencode/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
# SRE DevOps Writer for OpenCode

This folder is a standalone, OpenCode-compatible port of the DSH plugin at
`plugins/sredevops-writer/`. It contains three editorial skills in OpenCode's
standard directory-based layout, the reference files each skill reads, and a
minimal plugin registration.

It does not import from, modify, or depend on the DSH package. You can copy this
folder into an OpenCode project or into a global OpenCode configuration
directory and use it on its own.

## Layout

OpenCode derives a skill's ID from its directory name, so
`skills/sredevops-article/SKILL.md` has the ID `sredevops-article`. The
frontmatter `name` is the display label and `description` is what OpenCode uses
to decide when to advertise the skill. `whenToUse` is preserved from the DSH
skill as advisory metadata; OpenCode does not document it as a standard field.

```text
.opencode/
├── README.md
├── opencode.json
├── skills/
│ ├── sredevops-article/
│ │ ├── SKILL.md
│ │ └── references/
│ │ ├── voice-and-style.md
│ │ ├── ghost-package.md
│ │ ├── research-and-citations.md
│ │ ├── editorial-memory.md
│ │ └── site-examples.md
│ ├── sredevops-translate/
│ │ ├── SKILL.md
│ │ └── references/
│ │ ├── es-cl-voice.md
│ │ └── glossary.md
│ └── sredevops-editorial-memory/
│ ├── SKILL.md
│ └── references/
│ └── editorial-memory.md
└── sredevops-writer-plugin/
└── index.ts
```

| Skill | File | What it does |
| --- | --- | --- |
| `sredevops-article` | `skills/sredevops-article/SKILL.md` | Drafts, rewrites, researches, structures, and packages an SRE/DevOps article for sredevops.org in English or Chilean Spanish, including Ghost-ready metadata and the mandatory file-plus-chat delivery. |
| `sredevops-translate` | `skills/sredevops-translate/SKILL.md` | Translates articles, excerpts, titles, and Ghost packages between English and Chilean Spanish while preserving Markdown, code, links, identifiers, and technical meaning. |
| `sredevops-editorial-memory` | `skills/sredevops-editorial-memory/SKILL.md` | Saves, reviews, and removes durable editorial corrections in the shared memory file, including terminology overrides, tone adjustments, and structural preferences. |

## Install

### Project-local (recommended for a checkout)

Copy the whole `.opencode/` directory to the root of the project where you run
OpenCode. OpenCode automatically discovers `.opencode/skills/` and
`.opencode/opencode.json`; the `skills` entry in `opencode.json` makes the
registration explicit.

### Global

Copy the skill directories into the global skills location and merge the config:

```bash
# Either location works; OpenCode V2 documents the second one.
mkdir -p ~/.opencode/skills
cp -R .opencode/skills/. ~/.opencode/skills/

# or:
mkdir -p ~/.config/opencode/skills
cp -R .opencode/skills/. ~/.config/opencode/skills/
```

Then merge `.opencode/opencode.json` into your OpenCode config
(`~/.opencode/opencode.json` or `~/.config/opencode/opencode.json`), keeping any
existing keys:

```json
{
"$schema": "https://opencode.ai/config.json",
"skills": ["./skills"],
"plugin": ["./sredevops-writer-plugin"]
}
```

Adjust the paths to the location you used:

- `skills`: `"./skills"` resolves next to the config file, so it is correct for
both `~/.opencode/` and `~/.config/opencode/` once the copy above is done.
- `plugin`: `"./sredevops-writer-plugin"` resolves next to the config file too.
Copy the plugin directory next to the config
(`cp -R .opencode/sredevops-writer-plugin ~/.config/opencode/`) or drop the
`plugin` entry entirely. The skills do not depend on it.

OpenCode watches configuration and skill files and reloads them without a
restart. If a change does not appear, run `/reload`.

## Tool mapping

The DSH preset declares tool rows in `cordis.patch.yml`. OpenCode already ships
equivalent built-in tools, so this port does not reimplement them. The mapping
is documented as a comment in `sredevops-writer-plugin/index.ts`:

| DSH row | DSH behavior | OpenCode equivalent |
| --- | --- | --- |
| `time-context` | Injects the current date/time context | Built-in date/environment context; no tool |
| `tool-web` | `web_search`, `web_fetch` | `websearch`, `webfetch` |
| `tool-fs` | Read, write, edit files | `read`, `write`, `edit` |
| `tool-fs-search` | File search | `glob`, `grep` |
| `skill-filesystem` + `tool-skill` | Skill catalog and loader | Built-in skill discovery and the `skill` tool |
| `tool-ask-user` | Ask the user a question | `question` |
| `present` | Present a written file | No direct OpenCode equivalent; deliver in chat, or implement your own tool |
| `compaction` | Context compaction | Built-in compaction |

The skill bodies are faithful to the DSH originals and still mention
`present`, `web_search`, and `web_fetch`. In OpenCode, read `present` as "the
file is already written and the content is posted in chat", and the web calls as
`websearch` / `webfetch`.

## Path normalization

The DSH skills use directory bundles, so the layout matches the source. Only the
support-file paths were adjusted:

- Each skill reads its own `references/<file>.md`, relative to its directory.
- `sredevops-translate` reads `../sredevops-article/references/ghost-package.md`
and `../sredevops-editorial-memory/references/editorial-memory.md`, because
those files live in the sibling skills.
- `sredevops-editorial-memory` reads
`../sredevops-translate/references/glossary.md` for terminology updates.
- In `sredevops-translate/references/glossary.md`, the memory pointer is
`../../sredevops-editorial-memory/references/editorial-memory.md`.

No instruction, rule, example, or editorial behavior was changed.

## Editorial memory

The mutable memory file ships twice:

- `skills/sredevops-editorial-memory/references/editorial-memory.md` — the copy
the editorial-memory skill edits.
- `skills/sredevops-article/references/editorial-memory.md` — the copy the
article skill reads.

After saving a rule, sync the article copy so drafts pick it up:

```bash
cp .opencode/skills/sredevops-editorial-memory/references/editorial-memory.md \
.opencode/skills/sredevops-article/references/editorial-memory.md
```

If you prefer a single source of truth, point the article skill at
`../sredevops-editorial-memory/references/editorial-memory.md` and delete its
local copy.

## Standalone copy

- No imports from `plugins/sredevops-writer/`; no build step and no npm install.
- The DSH persona/system prompt and the `cordis.patch.yml` preset wiring are not
part of this port. If you want the same always-on voice, add the persona text
from `cordis.patch.yml` as an agent `system` prompt in `opencode.json`.
- The editorial memory is a normal file you can edit.
- License: MIT, the same as the source plugin.
5 changes: 5 additions & 0 deletions .opencode/opencode.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"$schema": "https://opencode.ai/config.json",
"skills": ["./skills"],
"plugins": ["./sredevops-writer-plugin"]
}
94 changes: 94 additions & 0 deletions .opencode/skills/sredevops-article/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
---
name: sredevops-article
description: Draft, write, rewrite, or improve an SRE/DevOps article for sredevops.org in English or Chilean Spanish, including research, structure, and Ghost-ready metadata. Use for article briefs, drafts, rewrites, headlines, excerpts, tags, or editorial feedback.
whenToUse: The user asks to write, draft, rewrite, refine, outline, or package an article, news piece, tutorial, or opinion post for sredevops.org or an SRE/DevOps audience.
---

# Write an article for sredevops.org

## Before you start

Read `references/voice-and-style.md` and `references/ghost-package.md` before drafting, and `references/research-and-citations.md` before researching claims. Read `../sredevops-editorial-memory/references/editorial-memory.md` and apply every standing correction; it overrides the glossary and style guide where they conflict. Open one or two files in `references/site-examples.md` only when calibration helps; do not copy lines or structure mechanically. If the user gives a durable correction during review, load `sredevops-editorial-memory` and persist it.

## Step 1: Parse the brief

Identify:

- **Mode** — new draft, rewrite, or light edit. If the user supplies text and says "improve", "fix", "review", or "edit", it is a rewrite, not a blank-page draft.
- **Language** — English or Spanish. Match the user's request or the source draft. If neither is clear, ask one short question and wait.
- **Topic and angle** — the specific claim, change, or question the article answers. "Kubernetes" is not an angle; "why the new Node Readiness Controller changes scheduling gates" is.
- **Audience** — practitioner by default; adjust for decision-makers.
- **Length** — follow `references/ghost-package.md`. Default 600–1500 words, excluding code and references.
- **Sources** — anything the user supplied, plus what you must find.

Ask at most two questions, and only when the topic, language, or factual scope cannot be inferred. Do not interview the user for a brief they already gave. If you assume something, state it in an editor note after the references.

## Step 2: Research

Use `web_search` and `web_fetch`; prefer official docs and release notes, primary vendor engineering posts, NVD/CVE/RFC/standards, then independent analysis. Community posts are sentiment, not fact. For each claim capture the source URL, the version/date it applies to, and whether you actually read the page. Meet the sourcing minimums in `references/research-and-citations.md`; if you cannot, narrow the claims. Never invent a URL, quote, benchmark, or version. Unreachable or paywalled pages go in the editor notes.

## Step 3: Outline

Build a short outline: a concrete hook (not a definition), context, three to six H2 sections that each make one point, an operational takeaway, and a close that leaves the trade-off open. For a tutorial, use prerequisites, steps, verification, cleanup, and the failure modes readers will actually hit.

## Step 4: Draft

Follow the voice reference. In particular:

- Sentence-case headings in both languages.
- Short paragraphs. One idea per paragraph.
- Concrete nouns and numbers. Replace "significant performance improvements" with the measured number and its conditions, or cut the claim.
- Code fences with a language identifier. Copy or trim snippets from the cited source; mark any adaptation untested. Never include real credentials, cluster names, or account IDs.
- Tables for comparisons and version matrices, not for prose.
- Inline links on descriptive text. No "click here", no bare URLs in the body.
- Bold for the one sentence that matters, not for decoration. No emoji unless the user's brief uses them.

Do not write a generic introduction, a "key takeaways" box, or a conclusion that repeats the headings.

## Step 5: Self-review

- [ ] Every factual claim has a source you read, or is marked opinion/unverified.
- [ ] Versions, dates, CVE IDs, and flags are correct; every link resolves.
- [ ] Code is copied from documentation or marked untested; you did not claim to run it.
- [ ] The piece says something specific and the jokes do not undercut a safety warning.
- [ ] Spanish is Chilean Spanish with `tú` and consistent technical terms.
- [ ] Word count and Ghost fields are within limits; the body has no H1, except in body-only mode.
- [ ] `write` returned success for `<slug>.md`, and the same content is pasted in the reply.

## Step 6: Deliver

Deliver the package **twice**: as a file and in chat.

1. **Write the file first.** Call the `write` tool with the full Markdown and `<slug>.md` as a relative filename; it resolves against the session working directory. This step is mandatory: the user does not have to ask for a file.
2. **Call `present`** with that file.
3. **Post the package in chat**: the `**Ghost fields**` block, a horizontal rule, the body from the introduction with no H1, references (`## Referencias` in Spanish, `## References` in English), and optional three-bullet editor notes.

The chat reply is the primary deliverable. Do not replace it with a pointer to the file, and do not paste the content a third time. Never say a file was written unless `write` returned success; if it fails, say so and still deliver the full package in chat.

For a headline, excerpt, tag set, or feedback only, return just that element (three options for a headline) and write no file.

No preamble, no "I hope this helps", no restating the brief.

## Rewrite mode

When the user supplies a draft:

1. Read the whole draft before changing anything.
2. Preserve the argument, intended audience, and claims unless the user asks you to change them.
3. Fix structure, transitions, false claims, weak sourcing, and filler.
4. Add sources for existing claims where possible; do not add new claims to make the piece feel bigger.
5. Apply the house voice; keep the author's own voice only if the user explicitly asks.
6. Deliver the full revised package as in Step 6, then up to three bullets under `**What changed**` (or `**Qué cambió**`).

If the draft is factually wrong, correct it and flag the correction in the change note. Do not silently rewrite history. When the revision starts from a file you wrote earlier, overwrite that file instead of creating a second one.

## Body-only and other output modes

Body-only Markdown keeps the H1 and drops the Ghost fields block; it still gets its `<slug>.md` file. Chat only when the user asks for that.

## Failure modes

- **No usable sources** — say what is missing and ask for a source or permission to write an opinion piece instead. Do not fill the gap with plausible-sounding detail.
- **Topic too broad** — propose two or three specific angles and ask the user to pick one.
- **User asks for a hit piece** — keep the criticism factual and aimed at the decision or the vendor behavior, not at a person.
- **User asks you to claim you tested something** — refuse and mark the snippet untested.
Loading
Loading