@itswakkana/fyi 0.0.0-stage → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +254 -2
- package/package.json +34 -4
- package/skills/fyi/SKILL.md +96 -0
- package/skills/fyi/reference/doctor.md +63 -0
- package/skills/fyi/reference/find.md +59 -0
- package/skills/fyi/reference/hooks.md +38 -0
- package/skills/fyi/reference/init.md +43 -0
- package/skills/fyi/reference/organize.md +99 -0
- package/skills/fyi/reference/save.md +111 -0
- package/skills/fyi/reference/schema.md +182 -0
- package/skills/fyi/scripts/commands/context.mjs +95 -0
- package/skills/fyi/scripts/commands/doctor.mjs +118 -0
- package/skills/fyi/scripts/commands/find.mjs +137 -0
- package/skills/fyi/scripts/commands/hook.mjs +196 -0
- package/skills/fyi/scripts/commands/index.mjs +27 -0
- package/skills/fyi/scripts/commands/init.mjs +243 -0
- package/skills/fyi/scripts/commands/install.mjs +151 -0
- package/skills/fyi/scripts/commands/list.mjs +91 -0
- package/skills/fyi/scripts/commands/new.mjs +288 -0
- package/skills/fyi/scripts/commands/organize.mjs +160 -0
- package/skills/fyi/scripts/commands/show.mjs +62 -0
- package/skills/fyi/scripts/fyi.mjs +156 -0
- package/skills/fyi/scripts/lib/frontmatter.mjs +481 -0
- package/skills/fyi/scripts/lib/hooks.mjs +765 -0
- package/skills/fyi/scripts/lib/repo.mjs +325 -0
- package/skills/fyi/scripts/lib/store.mjs +546 -0
- package/skills/fyi/scripts/lib/templates.mjs +221 -0
- package/skills/fyi/scripts/lib/util.mjs +354 -0
- package/skills/fyi/scripts/lib/validate.mjs +257 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Ryan
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,255 @@
|
|
|
1
|
-
#
|
|
1
|
+
# fyi
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**Project memory for multi-app repos — shared by humans, Claude Code, Codex CLI, and OpenCode.**
|
|
4
|
+
|
|
5
|
+
[](LICENSE)
|
|
6
|
+
[](https://nodejs.org)
|
|
7
|
+
[](#design-decisions)
|
|
8
|
+
[](#multi-agent-support-and-hooks)
|
|
9
|
+
|
|
10
|
+
In a monorepo where each developer owns a few modules, debugging crosses boundaries. The person who traces a failed request learns which log query works, which ID ties the flow together, and which service actually owns the error. That knowledge usually dies in a chat thread. `fyi` turns it into a version-controlled file the next person — and the next agent — finds first.
|
|
11
|
+
|
|
12
|
+
Inspired by [Impeccable](https://github.com/pbakaus/impeccable) and structured as a standalone skill repository: a clean `skills/fyi/` source directory, plugin/tooling metadata under `.claude-plugin/`, `.github/`, and `.fyi/`, and optional read-only lifecycle hooks for **Claude Code**, **Codex CLI**, and **OpenCode**.
|
|
13
|
+
|
|
14
|
+
```text
|
|
15
|
+
Claude Code (.claude/skills/fyi + .claude/settings.json) ──┐
|
|
16
|
+
Codex CLI (.agents/skills/fyi + .codex/hooks.json) ──┼──▶ fyi CLI & hook engine ──▶ .fyi/ store (git)
|
|
17
|
+
OpenCode (.opencode/skills/fyi + .opencode/plugins/) ──┘
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Why files
|
|
21
|
+
|
|
22
|
+
- **Shareable through git.** Review a captured debugging recipe in a PR like code.
|
|
23
|
+
- **Readable without infrastructure.** No database, no server, no sync service.
|
|
24
|
+
- **Agent-native.** Markdown with YAML frontmatter is what LLMs read and edit best.
|
|
25
|
+
- **Diffable.** A changed business rule shows up as a changed line with an author and a date.
|
|
26
|
+
- **Zero dependencies.** Plain ESM on Node 18+ — no `npm install`, no lockfile, no build step.
|
|
27
|
+
|
|
28
|
+
## Install
|
|
29
|
+
|
|
30
|
+
Requires **Node 18+**.
|
|
31
|
+
|
|
32
|
+
### 1. Install skills + hooks + `.fyi/` store into any repo (recommended)
|
|
33
|
+
|
|
34
|
+
Run directly with `npx` or `bunx` (no `git clone` required):
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
# Install for Claude Code, Codex CLI, and OpenCode together
|
|
38
|
+
npx @itswakkana/fyi install . --agents all --hooks --init
|
|
39
|
+
# or with Bun
|
|
40
|
+
bunx @itswakkana/fyi install . --agents all --hooks --init
|
|
41
|
+
# or directly from GitHub
|
|
42
|
+
npx github:itswakkana/fyi install . --agents all --hooks --init
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Target specific agents if you only use a subset (`--agents` defaults to `claude` when omitted):
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
# Claude Code + Codex with hooks
|
|
49
|
+
npx @itswakkana/fyi install . --agents claude,codex --hooks --init
|
|
50
|
+
|
|
51
|
+
# Skills only (no hooks)
|
|
52
|
+
npx @itswakkana/fyi install . --agents all --init
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### 2. Install via `skills` CLI or Claude Code plugin
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
# Install the skill via the Agent Skills CLI
|
|
59
|
+
npx skills add itswakkana/fyi
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Or add this repository as a Claude Code plugin (uses `.claude-plugin/plugin.json` and `.claude-plugin/marketplace.json`).
|
|
63
|
+
|
|
64
|
+
### 3. Add or inspect hooks in an existing repo
|
|
65
|
+
|
|
66
|
+
Run from your repo root using whichever skill path is installed (`.claude/skills/fyi`, `.agents/skills/fyi`, or `.opencode/skills/fyi`):
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
node .claude/skills/fyi/scripts/fyi.mjs hook install --agents all
|
|
70
|
+
node .claude/skills/fyi/scripts/fyi.mjs hook status
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
> **Note:** OpenCode loads skills and `.opencode/plugins/` at startup — restart OpenCode after installing or updating hooks.
|
|
74
|
+
|
|
75
|
+
> **Tip:** Commands below are written as `fyi ...`. Because `fyi` installs no global binary, run `node skills/fyi/scripts/fyi.mjs ...` (in this repo) or `node .claude/skills/fyi/scripts/fyi.mjs ...` (in a target repo), or alias `fyi` in your shell.
|
|
76
|
+
|
|
77
|
+
The CLI walks upward from the current working directory and stops at the nearest project boundary: `.fyi/`, `.git` (directory or worktree file), `.claude/skills/fyi`, `.agents/skills/fyi`, or `.opencode/skills/fyi`. Pass `--root /path/to/repo` to target a repository explicitly.
|
|
78
|
+
|
|
79
|
+
## Multi-agent support and hooks
|
|
80
|
+
|
|
81
|
+
| Agent | Installed skill path | Lifecycle hook config | Wired events |
|
|
82
|
+
|---|---|---|---|
|
|
83
|
+
| **Claude Code** | `.claude/skills/fyi/` (+ `.claude-plugin/`) | `.claude/settings.json` (non-destructive merge) | `SessionStart`, `UserPromptSubmit`, `Stop` |
|
|
84
|
+
| **Codex CLI** | `.agents/skills/fyi/` | `.codex/hooks.json` (non-destructive merge) | `SessionStart`, `UserPromptSubmit`, `Stop` |
|
|
85
|
+
| **OpenCode** | `.opencode/skills/fyi/` | `.opencode/plugins/fyi.js` (zero-dependency ESM plugin) | `chat.message`, `experimental.chat.system.transform`, `experimental.session.compacting`, `event(session.idle)` |
|
|
86
|
+
|
|
87
|
+
All three hosts share one read-only hook engine ([skills/fyi/scripts/lib/hooks.mjs](skills/fyi/scripts/lib/hooks.mjs)):
|
|
88
|
+
|
|
89
|
+
1. **Session context:** Injects a compact `<fyi-context>` block with store status, detected apps, artifact counts, CLI path, and core search/capture rules.
|
|
90
|
+
2. **Zero-noise prompt matching:** On each prompt, runs a fast local search against `.fyi/` and injects `<fyi-matches>` only when high-confidence artifacts match. Unrelated coding prompts stay completely silent.
|
|
91
|
+
3. **Non-blocking turn hygiene:** On `Stop` / `session.idle`, respects `stop_hook_active` (never loops, never blocks) and stays silent unless `.fyi/` index is stale or config has issues.
|
|
92
|
+
4. **Safe config management:** `fyi hook install` and `fyi hook uninstall` preserve all unrelated user settings and hooks, refuse invalid JSON and symlinks, and never overwrite unmanaged OpenCode plugins without `--force`.
|
|
93
|
+
|
|
94
|
+
Knowledge capture and redaction always stay with the skill and developer — hooks never auto-save raw transcripts.
|
|
95
|
+
|
|
96
|
+
## Quick start
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
# 1. Detect apps and initialize .fyi/
|
|
100
|
+
node .claude/skills/fyi/scripts/fyi.mjs init
|
|
101
|
+
|
|
102
|
+
# 2. Capture a debugging recipe someone just figured out
|
|
103
|
+
node .claude/skills/fyi/scripts/fyi.mjs new pattern \
|
|
104
|
+
"Trace a request across services" \
|
|
105
|
+
--app api --app worker \
|
|
106
|
+
--tag logs --tag tracing \
|
|
107
|
+
--description "Follow one request id through gateway, api, and worker logs."
|
|
108
|
+
|
|
109
|
+
# 3. Fill in the generated Markdown sections:
|
|
110
|
+
# .fyi/patterns/trace-a-request-across-services.md
|
|
111
|
+
|
|
112
|
+
# 4. Search before the next debugging session
|
|
113
|
+
node .claude/skills/fyi/scripts/fyi.mjs find "request id logs" --app api
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Inside Claude Code, Codex, or OpenCode, just ask: *"how do we trace a request across services?"* — the hook surfaces matching artifacts immediately, the skill searches `.fyi/` first, and *"save this as a pattern"* captures new recipes.
|
|
117
|
+
|
|
118
|
+
## Repository layout
|
|
119
|
+
|
|
120
|
+
```text
|
|
121
|
+
fyi/
|
|
122
|
+
├── skills/
|
|
123
|
+
│ └── fyi/ the skill: SKILL.md, reference playbooks, Node CLI & tests
|
|
124
|
+
├── .claude-plugin/ Claude Code plugin, marketplace, and bundled hooks manifest
|
|
125
|
+
├── .fyi/ this repository's own knowledge store
|
|
126
|
+
├── .github/ CI workflows
|
|
127
|
+
├── AGENTS.md guidance for coding agents working in this repo
|
|
128
|
+
├── CHANGELOG.md
|
|
129
|
+
├── CONTRIBUTING.md
|
|
130
|
+
├── LICENSE
|
|
131
|
+
└── README.md
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## Commands
|
|
135
|
+
|
|
136
|
+
| Command | Purpose |
|
|
137
|
+
|---|---|
|
|
138
|
+
| `fyi context` | Store state, counts, active agent integrations, and session directives. |
|
|
139
|
+
| `fyi init [--refresh]` | Detect apps, create or repair `.fyi/`, seed draft app overviews. |
|
|
140
|
+
| `fyi new <type> "<title>"` | Capture an artifact (aliases: `save`, `add`, `capture`). |
|
|
141
|
+
| `fyi find "<query>"` | Ranked search over title, description, tags, apps, and body (alias: `search`). |
|
|
142
|
+
| `fyi list` | Catalog grouped by type (alias: `ls`). |
|
|
143
|
+
| `fyi show <id\|path\|title>` | Print one artifact (alias: `cat`). |
|
|
144
|
+
| `fyi index` | Rebuild `index.json` and `INDEX.md`. |
|
|
145
|
+
| `fyi organize [--fix]` | Report duplicates, stale files, missing metadata; apply surgical safe fixes. |
|
|
146
|
+
| `fyi doctor` | Health check (artifacts, secrets, index, hooks); exits `1` on errors. |
|
|
147
|
+
| `fyi hook <action>` | `install`, `uninstall`, `status`, or `run` hooks for Claude, Codex, and OpenCode. |
|
|
148
|
+
| `fyi install <repo>` | Install skills (and optional `--hooks` / `--init`) into another repository. |
|
|
149
|
+
|
|
150
|
+
Flags: `--app`, `--tag`, `--type`, `--status`, `--owner`, `--description`, `--title`, `--file`, `--ext`, `--related`, `--agents`, `--hooks`, `--host`, `--dry-run`, `--refresh`, `--include-packages`, `--fix`, `--force`, `--init`, `--json`, `--limit`, `--root`, `--include-archived`.
|
|
151
|
+
|
|
152
|
+
## Store layout
|
|
153
|
+
|
|
154
|
+
```text
|
|
155
|
+
.fyi/
|
|
156
|
+
config.json schema, detected apps, settings
|
|
157
|
+
INDEX.md generated catalog (do not edit)
|
|
158
|
+
index.json generated machine index (do not edit)
|
|
159
|
+
README.md directory guide
|
|
160
|
+
knowledge/
|
|
161
|
+
<app>/overview.md what the app is, owns, depends on
|
|
162
|
+
shared/ cross-app facts: glossary, environments, contracts
|
|
163
|
+
patterns/ reusable investigation recipes
|
|
164
|
+
runbooks/ deploy, rollback, incident, migration
|
|
165
|
+
docs/ durable documents and pointers
|
|
166
|
+
scripts/ runnable helpers with metadata
|
|
167
|
+
archive/ retired artifacts
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### Artifact types
|
|
171
|
+
|
|
172
|
+
| Type | Use it when… | Example |
|
|
173
|
+
|---|---|---|
|
|
174
|
+
| `pattern` | You solved an investigation once and want it repeatable | "Find the failed job by request id" |
|
|
175
|
+
| `knowledge` | A fact is durable and confirmed by a person | "Refunds settle at midnight in the billing timezone" |
|
|
176
|
+
| `runbook` | Someone must execute steps under pressure | "Roll back the API deploy" |
|
|
177
|
+
| `doc` | A document or pointer must survive | "ADR-014: event bus migration" |
|
|
178
|
+
| `script` | The reusable thing is a runnable command | "Dump slow queries for an hour" |
|
|
179
|
+
|
|
180
|
+
One concept per file. If an artifact mixes a fact and a procedure, split them and link with `related`.
|
|
181
|
+
|
|
182
|
+
### Artifact format
|
|
183
|
+
|
|
184
|
+
Markdown artifacts use YAML frontmatter:
|
|
185
|
+
|
|
186
|
+
```markdown
|
|
187
|
+
---
|
|
188
|
+
type: pattern
|
|
189
|
+
title: Trace a request across services
|
|
190
|
+
description: Follow one request id through gateway, api, and worker logs.
|
|
191
|
+
apps: [api, worker]
|
|
192
|
+
tags: [logs, tracing]
|
|
193
|
+
owner: Ryan
|
|
194
|
+
status: active
|
|
195
|
+
updated: 2026-11-10
|
|
196
|
+
related: [knowledge/shared/request-ids]
|
|
197
|
+
---
|
|
198
|
+
|
|
199
|
+
# Trace a request across services
|
|
200
|
+
|
|
201
|
+
## When to use
|
|
202
|
+
...
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
Scripts carry the same metadata in leading comments so they remain directly executable:
|
|
206
|
+
|
|
207
|
+
```js
|
|
208
|
+
#!/usr/bin/env node
|
|
209
|
+
// ---
|
|
210
|
+
// type: script
|
|
211
|
+
// title: Dump slow queries
|
|
212
|
+
// description: Print the slowest queries for one app and hour.
|
|
213
|
+
// apps: [api]
|
|
214
|
+
// tags: [database, performance]
|
|
215
|
+
// owner: Ryan
|
|
216
|
+
// status: active
|
|
217
|
+
// updated: 2026-11-10
|
|
218
|
+
// related: []
|
|
219
|
+
// ---
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
## Design decisions
|
|
223
|
+
|
|
224
|
+
- **Markdown + frontmatter, not a database.** Reviewable in PRs, readable by any tool, no sync service.
|
|
225
|
+
- **Generated index, never hand-edited.** `INDEX.md` and `index.json` are rebuilt atomically from files with content hashes to detect drift.
|
|
226
|
+
- **Surgical updates, not round-trips.** `organize --fix` edits only the `updated` line, preserving every other line and line ending.
|
|
227
|
+
- **Zero dependencies.** Plain ESM on Node 18+. No install step, no lockfile.
|
|
228
|
+
- **App detection is evidence, not truth.** The CLI scans workspaces and manifests and seeds draft overviews; owners and business rules are never invented.
|
|
229
|
+
- **Secrets are errors, not warnings.** `doctor` fails on high-confidence secret shapes anywhere in a file, including frontmatter. Placeholders (`<...>`, `{{...}}`) are ignored; the word "example" elsewhere on the line does not hide a real key.
|
|
230
|
+
- **Symlink- and traversal-safe.** Every write command refuses symlinked stores, directories, indexes, and hook config targets.
|
|
231
|
+
- **Archive, don't delete.** Retired knowledge keeps its history under `.fyi/archive/`.
|
|
232
|
+
- **The CLI is the interface; the skill is the judgment.** Hooks and CLI handle structure, search, and validation; the agent handles meaning and redaction.
|
|
233
|
+
|
|
234
|
+
## Development
|
|
235
|
+
|
|
236
|
+
```bash
|
|
237
|
+
# Run the end-to-end self-test (108 checks in an isolated temp fixture)
|
|
238
|
+
node skills/fyi/scripts/selftest.mjs
|
|
239
|
+
|
|
240
|
+
# Run unit & integration test suites (frontmatter, index, repo, root, safety, multi-agent hooks)
|
|
241
|
+
node --test skills/fyi/scripts/*.test.mjs skills/fyi/scripts/*-test.mjs
|
|
242
|
+
|
|
243
|
+
# Check the repository's own .fyi/ store
|
|
244
|
+
node skills/fyi/scripts/fyi.mjs doctor
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
All tests run in isolated temporary directories and assert that the repository's own `.fyi/` store remains untouched.
|
|
248
|
+
|
|
249
|
+
## Contributing
|
|
250
|
+
|
|
251
|
+
Contributions are welcome! See [CONTRIBUTING.md](CONTRIBUTING.md) and [AGENTS.md](AGENTS.md) for guidelines, invariants, and test requirements.
|
|
252
|
+
|
|
253
|
+
## License
|
|
254
|
+
|
|
255
|
+
[MIT](LICENSE)
|
package/package.json
CHANGED
|
@@ -1,6 +1,36 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itswakkana/fyi",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Project memory for multi-app repos across Claude Code, Codex CLI, and OpenCode.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"bin": {
|
|
8
|
+
"fyi": "skills/fyi/scripts/fyi.mjs"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"skills/fyi",
|
|
12
|
+
"!skills/fyi/scripts/selftest.mjs",
|
|
13
|
+
"!skills/fyi/scripts/*.test.mjs",
|
|
14
|
+
"!skills/fyi/scripts/*-test.mjs"
|
|
15
|
+
],
|
|
16
|
+
"engines": {
|
|
17
|
+
"node": ">=18"
|
|
18
|
+
},
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "git+https://github.com/itswakkana/fyi.git"
|
|
22
|
+
},
|
|
23
|
+
"homepage": "https://github.com/itswakkana/fyi#readme",
|
|
24
|
+
"bugs": {
|
|
25
|
+
"url": "https://github.com/itswakkana/fyi/issues"
|
|
26
|
+
},
|
|
27
|
+
"keywords": [
|
|
28
|
+
"claude-code",
|
|
29
|
+
"codex",
|
|
30
|
+
"opencode",
|
|
31
|
+
"agent-skills",
|
|
32
|
+
"monorepo",
|
|
33
|
+
"project-memory",
|
|
34
|
+
"knowledge-base"
|
|
35
|
+
]
|
|
36
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: fyi
|
|
3
|
+
description: "Use when a task needs project knowledge that lives outside the code: how to trace a request across services, which logs or queries to search, who owns a module, how a business flow or rule works, how to deploy or roll back, how to respond to an incident, how to onboard onto a module, or when a debugging session produced a reusable recipe worth saving. Also use when the user asks to find, save, organize, audit, or initialize the project's .fyi knowledge store. Built for multi-app monorepos where one developer's discovery should become everyone's starting point. Not for ordinary code edits, design work, or general web research."
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
user-invocable: true
|
|
6
|
+
argument-hint: "[context · find <query> · new <type> <title> · init · organize · doctor · hook · list · show · index · install]"
|
|
7
|
+
license: MIT
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
`fyi` is the project's shared memory: a version-controlled `.fyi/` store of reusable investigation patterns, business knowledge, runbooks, documents, and scripts. The store is read by people and agents; this skill is the read/write interface.
|
|
11
|
+
|
|
12
|
+
The problem it solves: in a multi-app repo, the person who debugs an issue learns how to search the logs, which IDs tie the flow together, and which service owns the failure. That knowledge usually stays in their head or a chat thread. `fyi` makes it a file the next person and the next agent find first.
|
|
13
|
+
|
|
14
|
+
## Setup
|
|
15
|
+
|
|
16
|
+
1. Identify the target project root from the workspace and user request. Run `node <skill-base-dir>/scripts/fyi.mjs context --root <project-root>` once per session. `<skill-base-dir>` is the directory containing this SKILL.md; it may be outside the target project. Reuse this result in the playbooks.
|
|
17
|
+
2. **Wherever the playbooks write `fyi <verb>`, run `node <skill-base-dir>/scripts/fyi.mjs <verb> --root <project-root>`** unless a `fyi` executable is on PATH. The skill does not install a global command.
|
|
18
|
+
3. Prepare the store before searching or capturing: run `init` for a missing store, missing config, or missing directories/overviews; run `index` for a stale catalog. These repairs preserve existing artifacts. If config exists but is unreadable, report the error and leave it intact. On an ordinary task, use CLI initialization directly, report “Created .fyi; no prior knowledge yet,” and continue the task. Reserve the [init playbook](reference/init.md) for explicit setup or onboarding requests.
|
|
19
|
+
4. If the user requested read-only work or prohibited initialization, inspect any existing store without repairs and continue the task if it is unavailable. State the limitation. An empty initialized store or a search with no matches is a knowledge gap, not a blocked task. After solving, apply the capture rule below.
|
|
20
|
+
5. Load the playbook for the request: [init](reference/init.md), [find](reference/find.md), [save](reference/save.md), [organize](reference/organize.md), [doctor](reference/doctor.md), [hooks](reference/hooks.md), or [schema](reference/schema.md).
|
|
21
|
+
|
|
22
|
+
## Core rules
|
|
23
|
+
|
|
24
|
+
1. **Search before solving.** For any debugging, tracing, "how does X work", "who owns X", or onboarding request, run `find` before re-deriving the answer. If a pattern exists, follow it. Say which artifact you used.
|
|
25
|
+
2. **Capture after solving.** When a session produces a recipe someone else could reuse — a log query, a trace path, a repro, a business rule confirmed by a person — save it. Save without asking when the user says "remember", "save", or "document this"; otherwise offer it in one line.
|
|
26
|
+
3. **The repo is evidence; people are authority.** Never invent owners, business rules, thresholds, or runbook steps. Mark unknowns as open questions.
|
|
27
|
+
4. **One artifact per concept.** Search first, then update the canonical file. Do not create a near-duplicate.
|
|
28
|
+
5. **Generated files are read-only.** `INDEX.md` and `index.json` come from `fyi index`. Never hand-edit them.
|
|
29
|
+
6. **No secrets, no raw logs.** Store the query and the reasoning, not credentials, tokens, customer data, or log dumps. Redact before writing.
|
|
30
|
+
7. **Write for a stranger.** Exact copy-pasteable commands, explicit `<placeholders>`, expected signals, and the failure modes you hit.
|
|
31
|
+
|
|
32
|
+
## Store layout
|
|
33
|
+
|
|
34
|
+
| Path | Holds |
|
|
35
|
+
|---|---|
|
|
36
|
+
| `.fyi/knowledge/<app>/` | App-scoped facts: ownership, flows, invariants, contracts |
|
|
37
|
+
| `.fyi/knowledge/shared/` | Cross-app facts: glossary, environment, architecture |
|
|
38
|
+
| `.fyi/patterns/` | Reusable investigation recipes: log searches, traces, repros |
|
|
39
|
+
| `.fyi/runbooks/` | Operational procedures: deploy, rollback, incident, migration |
|
|
40
|
+
| `.fyi/docs/` | Durable documents and pointers to specs, ADRs, contracts |
|
|
41
|
+
| `.fyi/scripts/` | Runnable helpers with metadata and usage notes |
|
|
42
|
+
| `.fyi/archive/` | Retired artifacts, kept for history |
|
|
43
|
+
| `.fyi/INDEX.md`, `.fyi/index.json` | Generated catalog. Do not edit. |
|
|
44
|
+
| `.fyi/config.json` | Schema version, detected apps, settings |
|
|
45
|
+
|
|
46
|
+
An artifact is one Markdown file with YAML frontmatter, or one script with the same frontmatter in a leading comment. Full field list and examples: [reference/schema.md](reference/schema.md).
|
|
47
|
+
|
|
48
|
+
## Commands
|
|
49
|
+
|
|
50
|
+
Run from the project root:
|
|
51
|
+
|
|
52
|
+
| Command | Purpose |
|
|
53
|
+
|---|---|
|
|
54
|
+
| `fyi context` | Store state, counts, session directives. Run first. |
|
|
55
|
+
| `fyi init [--refresh]` | Detect apps, create or repair `.fyi/`, seed app overview stubs. |
|
|
56
|
+
| `fyi new <type> "<title>"` | Create an artifact. Aliases: `save`, `add`, `capture`. |
|
|
57
|
+
| `fyi find "<query>"` | Ranked search across title, tags, apps, body. |
|
|
58
|
+
| `fyi list` | Catalog grouped by type. |
|
|
59
|
+
| `fyi show <id\|path\|title>` | Print one artifact. |
|
|
60
|
+
| `fyi index` | Rebuild `index.json` and `INDEX.md`. |
|
|
61
|
+
| `fyi organize [--fix]` | Report duplicates, stale files, missing metadata; apply safe fixes. |
|
|
62
|
+
| `fyi doctor` | Health check; exits 1 on errors. |
|
|
63
|
+
| `fyi hook <action>` | Install, uninstall, inspect, or run hooks for Claude Code, Codex, and OpenCode. |
|
|
64
|
+
|
|
65
|
+
Useful flags: `--app`, `--tag`, `--type`, `--status`, `--owner`, `--description`, `--title`, `--file`, `--ext`, `--related`, `--agents`, `--hooks`, `--host`, `--dry-run`, `--refresh`, `--include-packages`, `--fix`, `--force`, `--json`, `--limit`, `--root`, `--include-archived`.
|
|
66
|
+
|
|
67
|
+
Types: `pattern` (investigation recipe), `knowledge` (durable fact), `runbook` (procedure), `doc` (document or pointer), `script` (runnable helper).
|
|
68
|
+
|
|
69
|
+
## Routing
|
|
70
|
+
|
|
71
|
+
- **No argument or "what is fyi":** run `context`, then present the store state and the four most useful next actions. Do not auto-run a capture.
|
|
72
|
+
- **Debugging, tracing, "how do we find…", "who owns…", onboarding:** [find](reference/find.md). Search first; solve only after the store comes up empty.
|
|
73
|
+
- **"Remember this", "save this", "document this", or a solved reusable problem:** [save](reference/save.md).
|
|
74
|
+
- **"Clean up / organize / dedupe / this is stale":** [organize](reference/organize.md).
|
|
75
|
+
- **"Is the store healthy / out of date / broken":** [doctor](reference/doctor.md).
|
|
76
|
+
- **"Set up fyi / onboard this repo":** [init](reference/init.md).
|
|
77
|
+
- **Schema or format question:** [schema](reference/schema.md).
|
|
78
|
+
|
|
79
|
+
If a request spans two flows, search first, then save what the search produced.
|
|
80
|
+
|
|
81
|
+
## Capture quality bar
|
|
82
|
+
|
|
83
|
+
Before writing, the artifact must answer:
|
|
84
|
+
|
|
85
|
+
- **When do I use this?** A concrete symptom or task, not a topic.
|
|
86
|
+
- **What do I need first?** Access, tools, IDs, environment.
|
|
87
|
+
- **What exactly do I run?** Copy-pasteable commands with explicit placeholders.
|
|
88
|
+
- **What proves it worked?** Log lines, fields, status codes, expected output.
|
|
89
|
+
- **What goes wrong?** The gotchas the discoverer hit.
|
|
90
|
+
- **Who confirmed it?** Owner, source, ticket, or dashboard.
|
|
91
|
+
|
|
92
|
+
If the answer is a single command with no reasoning, save it as a `script` instead. If it is a fact with no procedure, save it as `knowledge`. If it is a procedure someone executes under pressure, save it as a `runbook`.
|
|
93
|
+
|
|
94
|
+
## Verification
|
|
95
|
+
|
|
96
|
+
After a capture, `fyi show <id>` must print the artifact, `fyi doctor` must exit 0 with no errors, and `fyi find "<the symptom>"` must rank it. Warnings from `doctor` are not success: review and resolve them. If the artifact does not rank, the title and tags are wrong for the next person.
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# Doctor flow
|
|
2
|
+
|
|
3
|
+
`fyi doctor` checks whether the store is structurally sound. Run it after init, after a batch of captures, and when search results look wrong.
|
|
4
|
+
|
|
5
|
+
## Step 1: Run the check
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
fyi doctor
|
|
9
|
+
fyi doctor --json
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Exit code 1 means at least one structural error. Warnings do not fail the command. In JSON mode, inspect `checks` for every check, including soft warnings such as missing apps or no artifacts; the `warnings` array contains artifact and config validation warnings.
|
|
13
|
+
|
|
14
|
+
## Step 2: Read the findings
|
|
15
|
+
|
|
16
|
+
| Finding | Meaning | Repair |
|
|
17
|
+
|---|---|---|
|
|
18
|
+
| `store is not initialized` | `.fyi/` does not exist; doctor stops before the checks | `fyi init` |
|
|
19
|
+
| `config` fail | `config.json` missing or unreadable | Restore from git, or remove it and run `fyi init` |
|
|
20
|
+
| `index.json` / `INDEX.md` fail | Catalog missing or unreadable | `fyi index` |
|
|
21
|
+
| `index is stale` | Artifact content or metadata changed after the last index | `fyi index` |
|
|
22
|
+
| `apps` warn | No apps detected | Add manifests, then `fyi init --refresh` |
|
|
23
|
+
| `artifacts` warn | Store is empty | Capture the first pattern |
|
|
24
|
+
| `missing description` | Search will rank it poorly | Add a one-line description |
|
|
25
|
+
| `missing frontmatter` | Metadata is missing or inferred; the file is indexed with fallback title/type/date | Add the schema fields, then `fyi index` |
|
|
26
|
+
| `invalid updated date` | Not `YYYY-MM-DD` | Fix the date |
|
|
27
|
+
| `unknown status` | Not `active`, `draft`, `stale`, `deprecated` | Fix the status |
|
|
28
|
+
| `unknown app` | App not in `config.json` | Correct the name, or add the app via `init --refresh` |
|
|
29
|
+
| `duplicate title` | Two artifacts claim the same concept | Merge via [organize](organize.md) |
|
|
30
|
+
| `related id not found` | Broken cross-link | Correct the id or remove the link |
|
|
31
|
+
| `stale` | Active artifact older than the threshold | Confirm, refresh, mark stale, or archive |
|
|
32
|
+
| `script has no metadata frontmatter` | Script is indexed with inferred title/date and cannot be filtered by app or tag | Add the metadata block, then `fyi index` |
|
|
33
|
+
| `type "x" disagrees with the y directory` | The `type:` field and the artifact's directory differ | The directory is authoritative; fix the `type:` field or move the file |
|
|
34
|
+
| `possible secret (...)` | High-confidence secret shape anywhere in the file, including frontmatter | Redact before doing anything else |
|
|
35
|
+
|
|
36
|
+
## Step 3: Repair in order
|
|
37
|
+
|
|
38
|
+
1. **Secrets first.** Redact the value, rotate it if it was real, then rerun. Do not proceed with a store that contains credentials.
|
|
39
|
+
2. **Structure next.** `fyi init` or `fyi index` for missing config and catalog.
|
|
40
|
+
3. **Metadata next.** `fyi organize --fix` for safe stamps and index rebuild; fix the rest by hand.
|
|
41
|
+
4. **Semantics last.** Merge duplicates, fix links, archive stale artifacts via [organize](organize.md).
|
|
42
|
+
|
|
43
|
+
## Step 4: Confirm
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
fyi doctor
|
|
47
|
+
fyi find "<a known artifact>"
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
`doctor` exits 0 and the known artifact ranks. Exit 0 with warnings is not "healthy": the command prints `No errors; N warnings to review` and reserves `Healthy.` for zero errors and zero warnings. If search is still wrong, the artifact's title, description, or tags are the problem, not the index.
|
|
51
|
+
|
|
52
|
+
`fyi organize --fix` returns the exit code of the state after its repairs, so a missing index repaired by `--fix` does not leave the command failing.
|
|
53
|
+
|
|
54
|
+
## When to ask
|
|
55
|
+
|
|
56
|
+
Ask the user before:
|
|
57
|
+
|
|
58
|
+
- deleting anything;
|
|
59
|
+
- rotating a secret;
|
|
60
|
+
- merging artifacts with different owners;
|
|
61
|
+
- marking an artifact `deprecated` when you are not sure it is wrong.
|
|
62
|
+
|
|
63
|
+
Everything else is a safe repair you can make and report.
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# Find flow
|
|
2
|
+
|
|
3
|
+
Use before solving anything the team may have already solved: debugging, tracing, "how does X work", "who owns X", onboarding, and incident response.
|
|
4
|
+
|
|
5
|
+
## Step 1: Boot
|
|
6
|
+
|
|
7
|
+
Complete the skill's Setup sequence and reuse its context result. If the initialized store is empty, say so in one line and proceed with the task. If initialization or repair was prohibited or failed, report the limitation and continue without search; preserve the failure details for repair. Offer capture after solving according to the skill's capture rule.
|
|
8
|
+
|
|
9
|
+
## Step 2: Search more than once
|
|
10
|
+
|
|
11
|
+
Search the way the next person would, not the way the current code is named.
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
fyi find "<symptom>"
|
|
15
|
+
fyi find "<service> logs" --app <app>
|
|
16
|
+
fyi find "<technology> timeout" --tag tracing
|
|
17
|
+
fyi find "who owns <module>"
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Try two or three formulations: the user's words, the service name, and the mechanism (`request id`, `queue`, `webhook`). Use `--type pattern` when you want a recipe rather than a fact.
|
|
21
|
+
|
|
22
|
+
`fyi find --json "<query>"` returns ids, paths, scores, and snippets when you need to select programmatically. Put the query after the flag or after `--`; a bare `fyi find --json` with no query prints usage. No matches exits 1 in both text and JSON modes; read `total` from `--json` when scripting.
|
|
23
|
+
|
|
24
|
+
## Step 3: Read before applying
|
|
25
|
+
|
|
26
|
+
Read the top result in full with `fyi show <id>`. Follow its `related` links when the recipe depends on a fact or another procedure.
|
|
27
|
+
|
|
28
|
+
Check freshness before trusting it:
|
|
29
|
+
|
|
30
|
+
- `status` must be `active`; `draft` means unconfirmed.
|
|
31
|
+
- `updated` should be recent enough for the system it describes; it records the last write or confirmation, not a guarantee.
|
|
32
|
+
- `apps` must include the app you are debugging, or be empty / `[shared]` for a cross-app artifact.
|
|
33
|
+
|
|
34
|
+
If a step contradicts the current repo, the artifact is stale. Do not silently follow it; note the mismatch and update it after you confirm the new behavior.
|
|
35
|
+
|
|
36
|
+
## Step 4: Apply and observe
|
|
37
|
+
|
|
38
|
+
Follow the artifact's commands with the real placeholders substituted. Compare the result against its **Expected signals** section. If the signals do not appear, the pattern may be stale or you may be in a different environment; say which.
|
|
39
|
+
|
|
40
|
+
## Step 5: Close the gap
|
|
41
|
+
|
|
42
|
+
If nothing matched:
|
|
43
|
+
|
|
44
|
+
1. Solve the problem normally.
|
|
45
|
+
2. Extract the reusable part: the query, the id that ties the flow together, the service order, the gotcha.
|
|
46
|
+
3. Capture it with the [save flow](save.md) before finishing, or offer to in one line.
|
|
47
|
+
|
|
48
|
+
If a result was close but incomplete, update that artifact instead of creating a new one.
|
|
49
|
+
|
|
50
|
+
## Step 6: Report what you used
|
|
51
|
+
|
|
52
|
+
In your answer, name the artifacts you followed, e.g. `Used patterns/trace-request-across-services`. This teaches the next person the store is real and tells reviewers which recipe needs maintenance.
|
|
53
|
+
|
|
54
|
+
## Anti-patterns
|
|
55
|
+
|
|
56
|
+
- Re-deriving a log query without searching first.
|
|
57
|
+
- Dumping the whole store into the answer; cite the one or two artifacts that mattered.
|
|
58
|
+
- Trusting a `draft` or `deprecated` artifact as confirmed truth.
|
|
59
|
+
- Treating a stale artifact as the user's mistake; fix it and say so.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Hooks playbook (Claude Code, Codex, OpenCode)
|
|
2
|
+
|
|
3
|
+
`fyi` provides optional, project-scoped lifecycle hooks for **Claude Code**, **Codex CLI**, and **OpenCode** backed by one shared, read-only hook engine (`scripts/lib/hooks.mjs`).
|
|
4
|
+
|
|
5
|
+
## Design boundaries
|
|
6
|
+
|
|
7
|
+
- **Read-only and non-blocking.** Hooks never mutate `.fyi/`, never block user prompts, and never trap the agent in a `Stop` loop (`stop_hook_active` is respected).
|
|
8
|
+
- **Zero noise.** `prompt-submit` only injects `<fyi-matches>` when high-confidence `.fyi/` artifacts match the user's prompt. `stop` stays silent unless `.fyi/` index or config needs attention.
|
|
9
|
+
- **Capture stays with the skill.** Hooks surface context and reminders; the skill and user decide what to capture and redact.
|
|
10
|
+
- **Non-destructive config merges.** Installing or uninstalling preserves unrelated settings and hooks in `.claude/settings.json` and `.codex/hooks.json`, and refuses to overwrite unmanaged `.opencode/plugins/fyi.js` without `--force`.
|
|
11
|
+
|
|
12
|
+
## What each host installs
|
|
13
|
+
|
|
14
|
+
| Host | Skill path | Hook integration | Lifecycle events |
|
|
15
|
+
|---|---|---|---|
|
|
16
|
+
| **Claude Code** | `.claude/skills/fyi/` | `.claude/settings.json` | `SessionStart`, `UserPromptSubmit`, `Stop` |
|
|
17
|
+
| **Codex CLI** | `.agents/skills/fyi/` | `.codex/hooks.json` | `SessionStart`, `UserPromptSubmit`, `Stop` |
|
|
18
|
+
| **OpenCode** | `.opencode/skills/fyi/` | `.opencode/plugins/fyi.js` | `chat.message`, `experimental.chat.system.transform`, `experimental.session.compacting`, `event(session.idle)` |
|
|
19
|
+
|
|
20
|
+
## Commands
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
# Install skills + hooks + store for all three agents into another repo
|
|
24
|
+
fyi install /path/to/repo --agents all --hooks --init
|
|
25
|
+
|
|
26
|
+
# Install or refresh hooks in the current repo
|
|
27
|
+
fyi hook install --agents claude,codex,opencode
|
|
28
|
+
|
|
29
|
+
# Check installed skills and hooks
|
|
30
|
+
fyi hook status
|
|
31
|
+
|
|
32
|
+
# Remove only fyi-managed hooks
|
|
33
|
+
fyi hook uninstall --agents all
|
|
34
|
+
|
|
35
|
+
# Test a hook event locally
|
|
36
|
+
fyi hook run session-start --host claude
|
|
37
|
+
echo '{"prompt":"how do we trace a request id in api logs?"}' | fyi hook run prompt-submit --host codex
|
|
38
|
+
```
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Init flow
|
|
2
|
+
|
|
3
|
+
Use for an explicit setup or onboarding request. For an ordinary debugging or knowledge task, follow the minimal initialization in the skill's Setup sequence, then continue the original task.
|
|
4
|
+
|
|
5
|
+
## Step 1: Inspect current state
|
|
6
|
+
|
|
7
|
+
Reuse the context result from Setup. Check config, index files, store directories, and configured app overviews.
|
|
8
|
+
|
|
9
|
+
- **Missing store or config:** create the missing pieces with `fyi init`.
|
|
10
|
+
- **Partial store:** `fyi init` repairs missing directories and overviews and rebuilds a stale index while preserving artifacts.
|
|
11
|
+
- **Unreadable existing config:** report the error and leave the file intact for repair.
|
|
12
|
+
- **Complete store:** retain existing artifacts. Use `fyi init --refresh` only when re-detection is requested or apps have changed.
|
|
13
|
+
|
|
14
|
+
Honor read-only requests and explicit instructions against initialization. Report what is unavailable and continue any independent work.
|
|
15
|
+
|
|
16
|
+
## Step 2: Preview detection and create the store
|
|
17
|
+
|
|
18
|
+
Run `fyi init --dry-run --json` to inspect detected scopes. Then run `fyi init`, or `fyi init --refresh` for an intended scope refresh. Pass `--include-packages` when libraries should be scopes alongside apps.
|
|
19
|
+
|
|
20
|
+
The detector reads workspace manifests and conventional `apps/`, `packages/`, `services/`, `modules/`, and `libs/` directories. It unions conventional directories with workspace globs. Apps are selected by default; if none are found, it falls back to packages. Duplicate names gain parent path components or numeric suffixes. Names are deterministic for a given set of paths but may change when collisions appear or disappear; review scopes and links after refreshing.
|
|
21
|
+
|
|
22
|
+
Refresh prunes scopes no longer detected, keeping their knowledge files. If nothing is detected, all configured scopes are removed and the CLI prints a warning. Detection is evidence of structure, not authority about ownership or business behavior.
|
|
23
|
+
|
|
24
|
+
Initialization writes config, type directories, a directory guide, draft app overviews, and the generated catalogs. It succeeds even when no apps are detected. Report created or repaired files briefly; a store with draft overviews is ready for use, but contains no confirmed recipes yet.
|
|
25
|
+
|
|
26
|
+
## Step 3: Enrich from evidence
|
|
27
|
+
|
|
28
|
+
Read the root README, project guidance, manifests, and existing architecture or operational docs. Fill only supported facts in the overviews:
|
|
29
|
+
|
|
30
|
+
- what the app is and owns;
|
|
31
|
+
- dependencies and entry points;
|
|
32
|
+
- known owners and sources;
|
|
33
|
+
- open questions for everything unconfirmed.
|
|
34
|
+
|
|
35
|
+
Keep inferred content `status: draft`. Set `active` only after a person confirms it. Unknown owners can remain blank; they do not block setup.
|
|
36
|
+
|
|
37
|
+
Ask only when an answer changes the requested setup. Useful questions concern ownership, whether detected packages should be separate scopes, or a solved debugging recipe worth capturing. Keep any round to at most three questions. A common symptom alone is not evidence for a procedure.
|
|
38
|
+
|
|
39
|
+
## Step 4: Verify and report
|
|
40
|
+
|
|
41
|
+
Run `fyi index` after editing overviews, then `fyi doctor`. Resolve errors and review warnings; no detected apps is expected for a repository without matching manifests. Report detected scopes, draft versus confirmed content, created files, and unresolved questions.
|
|
42
|
+
|
|
43
|
+
If the user supplied a solved recipe and requested capture, use the [save flow](save.md). Otherwise offer capture after the first reusable discovery. Setup is complete without a pattern; the store grows one solved problem at a time.
|