jframe CLAUDE.md

A project guide for jframe, a modular Go application framework whose features are organized as modules and whose dependencies are shared through a dependency-injection container.

In plain words
What is it for?
Use it when adding or modifying jframe modules, configuration, dependency wiring, lifecycle methods, commands, routes, or long-running services.
Why use it?
It gives coding agents the project’s architecture, startup order, and dependency rules so they can change code without breaking how modules connect or shut down.

Instructions file

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 instructions/juanjitech/jframe/claude-md
Clone the repo
git clone --depth 1 https://github.com/juanjiTech/jframe
Per session 2,842 This file is loaded in full into every session.
When invoked 2,842 The same file — it is already loaded in full.
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.02842 $0.02842
Opus 5 $0.01421 $0.01421
Sonnet 5 $0.00568 $0.00568
Haiku 4.5 $0.00284 $0.00284

Measured 2d ago against content hash 97f7ead92adb, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

jframe CLAUDE.md 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 2d ago.

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.

CLAUDE.md · 243 lines

How it starts

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

CLAUDE.md — jframe 项目 Agent 开发指南

项目概述

jframe 是一个基于模块化内核的 Go 应用脚手架框架。所有功能以 kernel.Module 为单位组织,通过依赖注入容器 (inject/v2) 在模块间传递依赖,实现零耦合。

仓库: github.com/juanjiTech/jframe Go 版本: 1.23+ 入口: main.gocmd.Execute() → Cobra 子命令

核心架构

模块系统

所有功能都封装为 kernel.Module(定义在 core/kernel/module.go)。

Module 接口:

Name() string                           — 唯一标识符,同时作为配置 YAML key
Config() any                            — 返回配置结构体指针,nil 表示无配置
PreInit(*Hub) / Init(*Hub) / PostInit(*Hub) / Load(*Hub) — 4 个顺序初始化阶段
Start(*Hub)                             — 在独立 goroutine 中运行(长驻任务)
Stop(*sync.WaitGroup, context.Context)  — 优雅关闭(并发执行,必须 defer wg.Done())

生命周期执行顺序:

  1. Config 反序列化(遍历所有模块)
  2. PreInit(遍历所有模块)— 创建资源,Map 到 DI 容器
  3. Init(遍历所有模块)— 校验依赖
  4. PostInit(遍历所有模块)— 跨模块装配
  5. Load(遍历所有模块)— 注册路由、启用插件
  6. Start(每个模块一个 goroutine)— 长驻服务

所有模块必须嵌入 kernel.UnimplementedModule,这是 gRPC 风格的前向兼容模式(mustEmbedUnimplementedModule() 未导出方法强制嵌入)。

依赖注入 (DI)

基于 github.com/juanjiTech/inject/v2,一个反射驱动的类型映射容器。

Hub 结构体(core/kernel/module.go:10)包装了 inject.Injector + *zap.SugaredLogger,传入每个生命周期方法。

核心 DI 操作:

  • hub.Map(&value) — 注册依赖(按指针类型作为 key),一个类型只能存一个值
  • hub.Load(&variable) — 获取依赖(必须检查 error)
  • hub.Invoke(func(dep Type) { ... }) — 函数参数自动注入
  • hub.Value(reflect.Type) — 底层按类型直接查找

重要规则:

  • Map 总是传指针:hub.Map(&db) 不是 hub.Map(db)
  • Load 只能获取已被其他模块 Map 过的类型
  • 同类型只能存一个值,需要多个相同类型用包装结构体区分
  • 内核在所有模块之前 Map 了 *net.Listenercmux.CMux

配置系统

全局配置: conf/vars.goGlobalConfig 结构体,通过 conf.Get() 获取。

模块配置: 每个模块的 Config() 返回自定义结构体指针。内核使用 reflect.StructOf 动态构建包含 mapstructure tag 的结构体,由 Viper 按 Name() 自动映射:

// 内核内部操作 (kernel.go:69-85)
structType := reflect.StructOf([]reflect.StructField{{
    Name: "Config",
    Type: reflect.TypeOf(moduleConfig),
    Tag:  reflect.StructTag(`mapstructure:"moduleName"`),
}})
instance := reflect.New(structType)
instance.Elem().Field(0).Set(reflect.ValueOf(moduleConfig))
viper.Unmarshal(instance.Interface())

Read the full file on GitHub · 243 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. 2d ago First seen · 243 lines · 2,842 tokens per session scan A 97f7ead92adb

Subscribe to this mod's changes

jframe CLAUDE.md is an instructions file published in the GitHub repository juanjiTech/jframe (5 stars, last pushed 2mo ago), licensed Apache-2.0. It adds 2,842 tokens to every session, about $0.0142 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-31.