context

A project-context command that manages a .context directory containing decision notes, session logs, and history. It helps keep a record of why changes were made across Git branches and commits.

In plain words
What is it for?
Use it to initialize project context files, add notes, view or compress session logs, inspect commit history, and combine history records when squashing Git commits.
Why use it?
Important decisions can otherwise be lost in chat, terminal output, or scattered commit messages. The stored history makes past project context easier to review.

Command

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/fengshao1227/ccg-workflow/context
Clone the repo
git clone --depth 1 https://github.com/fengshao1227/ccg-workflow
Per session 23 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,482 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00023 $0.02482
Opus 5 $0.00012 $0.01241
Sonnet 5 $0.00005 $0.00496
Haiku 4.5 $0.00002 $0.00248

Measured yesterday against content hash 6f0773fbd632, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

context scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

Copies of this mod

1 near-identical copy found in the catalogue:

  • context — 100% identical, 0 lines differ
templates/commands/context.md · 333 lines

How it starts

The opening of the file, as written. The whole thing — 333 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Context - 项目上下文管理

管理 .context/ 目录结构,为 LLM 工具提供决策审计链。

使用方法

/context <subcommand> [options]

子命令

子命令 说明
init 初始化 .context/ 目录结构
log <message> (可选)手动追加备注到 session.log,commit 时会合并
show 查看当前分支的 session.log
compress 压缩 session.log → uncommit.md(手动预览用)
history 查看 history/commits.md
squash <ids...> 合并多条 history 记录(配合 git squash)

核心用法init 一次,之后只管开发。/ccg:commit 提交时自动从 git diff 分析决策并归档到 history/。log 仅在你想手动补充备注时使用。


执行工作流

子命令:init

[模式:初始化]

在当前项目根目录创建 .context/ 结构:

  1. 检测项目根目录(查找 .git/
  2. .context/ 已存在,跳过已有文件,仅补全缺失
  3. 创建以下结构:
.context/
├── .gitignore
├── .gitattributes
├── prefs/
│   ├── coding-style.md
│   └── workflow.md
├── current/
│   └── branches/
│       └── .gitkeep
└── history/
    ├── commits.jsonl
    ├── commits.md
    └── archives/
        └── .gitkeep
  1. 创建 .context/.gitignore
# Ephemeral workspace — never commit
current/

# Raw interaction logs — always local only
**/session.log
**/session.raw.log
**/*.session.log
**/*.raw.log

# Editor / temp
**/*.tmp
**/*.bak
**/*.swp
  1. 创建 .context/.gitattributes
# JSONL append-only: 'union' merge reduces conflicts
history/commits.jsonl merge=union
history/archives/*.jsonl merge=union
  1. 创建 .context/prefs/coding-style.md(团队编码规范模板):
# Coding Style Guide

> 此文件定义团队编码规范,所有 LLM 工具在修改代码时必须遵守。
> 提交到 Git,团队共享。

## General
- Prefer small, reviewable changes; avoid unrelated refactors.
- Keep functions short (<50 lines); avoid deep nesting (≤3 levels).
- Name things explicitly; no single-letter variables except loop counters.
- Handle errors explicitly; never swallow errors silently.

## Language-Specific
<!-- 根据项目语言补充,例如:-->
<!-- ### TypeScript -->
<!-- - Use strict mode; prefer `interface` over `type` for object shapes. -->

## Git Commits
- Conventional Commits, imperative mood.
- Atomic commits: one logical change per commit.

## Testing
- Every feat/fix MUST include corresponding tests.
- Coverage must not decrease.
- Fix flow: write failing test FIRST, then fix code.

## Security
- Never log secrets (tokens/keys/cookies/JWT).
- Validate inputs at trust boundaries.

Read the full file on GitHub · 333 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 333 lines · 23 tokens per session scan A 6f0773fbd632

Subscribe to this mod's changes

context is a command published in the GitHub repository fengshao1227/ccg-workflow (5,865 stars, last pushed 2d ago), licensed MIT. It adds 23 tokens to every session and 2,482 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.