Second Brain
Use the bundled CLI script instead of hand-writing API calls.
Script
- Primary path (installed skill):
$CODEX_HOME/skills/second-brain/sbrain.sh - Local development fallback:
/Volumes/git/portfolio-projects/mattbub.com/.agents/skills/second-brain/scripts/sbrain.sh - Alternate fallback:
/Volumes/git/mattbub.com/second-brain/sbrain.sh
If the script is not executable, run chmod +x <script-path>.
Workflow
Step 1.
Review the current working tree changes (unstaged + untracked) and write a concise markdown summary for Mat.
Primary source:
- The actual git diff/status in this repo (unstaged and untracked files).
Context source:
- Prompt/chat history, only to explain intent behind the changes when needed.
What to include:
- What changed in the code right now.
- Why those changes were made (inferred from chat history).
- If helpful, include tiny code examples from the current diff to ground the summary in concrete changes.
Constraints:
- 1-2 short paragraphs max.
- Target audience: product stakeholders
- No lists unless absolutely necessary.
- Only use fenced code blocks when a small example is necessary for clarity.
- No meta narration about your role, process, use of git, or tone changes.
- Do not say things like "as Mat's assistant" or describe "what happened in the conversation."
- Keep it direct, technical, and specific to the current working tree.
Voice:
- First person ("I") for the assistant.
- Refer to the user as "Mat".
Bridge from Step 1 to script call:
- Use the Step 1 summary as
contextexactly as written. - Preserve
contexttext as-is, including punctuation and line breaks. - Generate
titlefrom the commit message subject line (Conventional Commits format) you will use in Step 2. - Resolve
projectautomatically, in this order, unless the user explicitly providesproject:package.jsonnamego.modmodule path basenamepyproject.tomlproject name- current working directory name (basename of
$PWD)
- Do not ask the user for required fields during normal operation. This skill should run with zero additional user input.
- Run the script with quoted arguments:
<script-path> --title "<title>" --context "<context>" --project "<project>"- If project resolution fails, omit
--projectand allow the script default from CWD.
- Add optional fields only when provided by the user:
--commits "<commits>"--tags "<tags>"
- Return the API response to the user and include the created record ID when present.
Step 2.
Run git diff, group changes sensibly, and commit using Conventional Commits: https://www.conventionalcommits.org/en/v1.0.0/
Rules
- Prefer the script over direct
curl. - Use
--api-urlorSBRAIN_API_URLonly when the user asks to target a different environment. - Build the Conventional Commit subject from current changes before calling
sbrain.sh, then use that same subject for both the script--titleand the git commit message. - Invoke
sbrain.shas a side effect of Step 1 (using the Step 1 summary ascontext) before executing the Step 2 commit command.