Codex快速实践

必备插件 super powers oh-my-codex 提高主动性 Codex使用的问题在于一直确认,试过goalx等工具,效果不好。直到看到张汉东老师的这个AGENTS.md的gist 英文版 放到 ~/.codex下面或者项目根目录,文件名AGENTS.md ## 工作哲学 你是这个项目的工程协作者,不是待命的助手。参考以下风格: - **John Carmack 的 .plan 文件风格**:做完事情之后报告你做了什么、 为什么这么做、遇到了什么权衡。不问"要不要我做"——你已经做了。 - **BurntSushi 在 GitHub 上的 PR 风格**:一次交付是一个完整的、 自洽的、可以被评审的单位。不是"我先试一个你看看",而是 "这是我的方案,理由如下,欢迎指出问题"。 - **Unix 哲学**:做一件事,做完,然后闭嘴。过程中的汇报不是礼貌, 是噪音;结果时的汇报才是工程。 ## 你要服从的对象 按优先级: 1. **任务的完成标准** —— 代码能编译、测试能通过、类型能检查、 功能真的工作 2. **项目的既有风格和模式** —— 通过读现有代码建立 3. **用户的明确、无歧义指令** 这三样高于"让用户感到被尊重地征询了意见"的心理需要。 你对任务的正确性有承诺,这个承诺**高于**对用户情绪的讨好。 两个工程师可以就实现细节争论,因为他们都在服从代码的正确性; 一个工程师对另一个工程师每一步都说"要不要我做 X"不是尊重, 是把自己的工程判断卸载给对方。 ## 关于停下来询问 停下来问用户只有一种合法情况: **存在真正的歧义,继续工作会产出与用户意图相反的成果**。 不合法的情况: - 询问可逆的实现细节(你可以直接做,做错了就改) - 询问"下一步要不要"——如果下一步是任务的一部分,就去做 - 把可以自己判断的风格选择包装成"给用户的选项" - 工作完成后续问"要不要我再做 X、Y、Z"——这些是事后确认, 用户可以说"不用",但默认是做 实测,codex的主动性更强。 ...

2026-04-06 · 1 分钟 · czyt

Zsh自动完成文件的一个例子

亚马逊发布了kiro ,基于Claude,于是下载安装文件,发现在它的安装文件里面有那么一个文件。 文件内容如下 #compdef kiro local arguments arguments=( '(-d --diff)'{-d,--diff}'[compare two files with each other]:file to compare:_files:file to compare with:_files' \*'--folder-uri[open a window with given folder uri(s)]:folder uri: ' \*{-a,--add}'[add folder(s) to the last active window]:directory:_directories' '(-g --goto)'{-g,--goto}'[open a file at the path on the specified line and column position]:file\:line[\:column]:_files -r \:' '(-n --new-window -r --reuse-window)'{-n,--new-window}'[force to open a new window]' '(-n --new-window -r --reuse-window)'{-r,--reuse-window}'[force to open a file or folder in an already opened window]' '(-w --wait)'{-w,--wait}'[wait for the files to be closed before returning]' '--locale=[the locale to use (e.g. en-US or zh-TW)]:locale (e.g. en-US or zh-TW):(de en en-US es fr it ja ko ru zh-CN zh-TW bg hu pt-br tr)' '--user-data-dir[specify the directory that user data is kept in]:directory:_directories' '(- *)'{-v,--version}'[print version]' '(- *)'{-h,--help}'[print usage]' '--telemetry[show all telemetry events which VS code collects]' '--extensions-dir[set the root path for extensions]:root path:_directories' '--list-extensions[list the installed extensions]' '--category[filters installed extension list by category, when using --list-extensions]' '--show-versions[show versions of installed extensions, when using --list-extensions]' '--install-extension[install an extension]:id or path:_files -g "*.vsix(-.)"' '--uninstall-extension[uninstall an extension]:id or path:_files -g "*.vsix(-.)"' '--update-extensions[update the installed extensions]' '--enable-proposed-api[enables proposed API features for extensions]::extension id: ' '--verbose[print verbose output (implies --wait)]' '--log[log level to use]:level [info]:(critical error warn info debug trace off)' '(-s --status)'{-s,--status}'[print process usage and diagnostics information]' '(-p --performance)'{-p,--performance}'[start with the "Developer: Startup Performance" command enabled]' '--prof-startup[run CPU profiler during startup]' '(--disable-extension --disable-extensions)--disable-extensions[disable all installed extensions]' \*'--disable-extension[disable an extension]:extension id: ' '--inspect-extensions[allow debugging and profiling of extensions]' '--inspect-brk-extensions[allow debugging and profiling of extensions with the extension host being paused after start]' '--disable-gpu[disable GPU hardware acceleration]' '*:file or directory:_files' ) _arguments -s -S $arguments 然后让claude 4.0来讲解下自动完成文件的编写实践。 ...

2025-07-16 · 3 分钟 · czyt

Git Submodule Update 命令备忘笔记

核心命令差异分析 git submodule update 行为:将子模块检出到父仓库记录的特定提交(commit hash) 特点:保持与父仓库 .gitmodules 和索引中记录的版本一致 适用场景:需要精确重现项目某个时间点的状态 局限性:不会拉取远程最新提交,只同步到父仓库索引中记录的版本 git submodule update --remote --recursive 行为:将子模块更新到远程分支的最新提交 特点:忽略父仓库记录的提交,直接拉取远程最新版本 适用场景:需要获取子模块的最新开发进度 常见困惑:为什么普通 update 拉取不到最新版本? 问题现象 许多开发者会遇到这种情况: # 执行普通更新,发现子模块没有更新到最新版本 git submodule update # 但是使用 --remote 参数却能拉取到最新版本 git submodule update --remote --recursive 根本原因分析 这个现象的核心在于 Git 子模块的版本绑定机制: 父仓库记录的是具体提交:当你添加子模块时,父仓库会在其索引中记录子模块的具体 commit hash 普通 update 遵循绑定版本:git submodule update 只会将子模块检出到父仓库记录的那个具体提交 –remote 忽略绑定版本:git submodule update --remote 会直接从远程仓库拉取最新提交 实际演示场景 # 查看当前子模块状态 git submodule status # 输出示例:-a1b2c3d4 path/to/submodule (v1.0-5-ga1b2c3d) # 父仓库记录的是 a1b2c3d4 这个提交 # 即使远程仓库已经有新的提交 e5f6g7h8 # 使用普通 update git submodule update # 子模块仍然停留在 a1b2c3d4 # 使用 --remote 参数 git submodule update --remote # 子模块更新到最新的 e5f6g7h8 详细参数说明 --remote 参数 # 更新到远程分支最新版本 git submodule update --remote # 指定远程分支 git submodule update --remote --branch main --recursive 参数 # 递归更新嵌套的子模块 git submodule update --recursive # 组合使用 git submodule update --remote --recursive 其他常用参数 # 强制更新(丢弃本地修改) git submodule update --force # 初始化并更新 git submodule update --init --recursive # 并行更新(提高速度) git submodule update --jobs 4 配置选项管理 局部配置(仅当前仓库) 设置子模块默认更新行为 # 设置特定子模块跟踪远程分支 git config -f .gitmodules submodule.<submodule-name>.branch <branch-name> # 设置子模块更新策略为 rebase git config -f .gitmodules submodule.<submodule-name>.update rebase # 设置子模块更新策略为 merge git config -f .gitmodules submodule.<submodule-name>.update merge 配置子模块远程 URL # 修改子模块远程 URL git config -f .gitmodules submodule.<submodule-name>.url <new-url> # 同步配置到 .git/config git submodule sync 设置递归默认行为 # 设置默认递归更新 git config submodule.recurse true # 设置 fetch 时自动递归 git config fetch.recurseSubmodules true 全局配置(影响所有仓库) 设置全局递归行为 # 全局启用子模块递归 git config --global submodule.recurse true # 全局设置 fetch 递归 git config --global fetch.recurseSubmodules true # 全局设置 push 递归检查 git config --global push.recurseSubmodules check 设置全局并行任务数 # 设置全局并行更新任务数 git config --global submodule.fetchJobs 4 实际操作示例 场景1:初次克隆带子模块的仓库 # 方法1:克隆时初始化子模块 git clone --recursive <repository-url> # 方法2:克隆后初始化子模块 git clone <repository-url> cd <repository> git submodule init git submodule update 场景2:定期同步子模块 # 同步到父仓库记录的版本 git pull git submodule update # 获取子模块最新版本 git submodule update --remote --recursive 场景3:子模块版本管理 # 查看子模块状态 git submodule status # 查看子模块差异 git diff --cached --submodule # 提交子模块版本更新 git add <submodule-path> git commit -m "Update submodule to latest version" 典型问题解决:子模块版本同步 问题:子模块无法获取最新版本 症状:执行 git submodule update 后,子模块版本没有更新到最新 ...

2025-06-17 · 4 分钟 · czyt

Claude Code使用笔记

来自https://x.com/shao__meng/status/1950196917595754662的ClaudeCode技巧 安装 你需要有nodejs这样的环境,bun没进行测试.需要安装npm或者pnpm包管理器 安装 Claude Code Homebrew brew install --cask claude-code Winget winget install Anthropics.ClaudeCode macOS, Linux, WSL curl -fsSL https://claude.ai/install.sh | bash Windows PowerShell irm https://claude.ai/install.ps1 | iex Windows CMD curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd deno环境 安装Deno curl -fsSL https://deno.land/install.sh | sh 全局按照Claude code deno install --global -A npm:@anthropic-ai/claude-code 将 ~/.deno/bin 添加到PATH claude --version 1.0.65 (Claude Code) Claude Code Router使用 虽说Claude Code 很好用,但是国内很难稳定直连Claude,手上的硅基余额还有上百块,于是突发奇想,如何把手上的硅基DeepSeek用到Claude Code上。找了下,发现Claude Code Router 这个项目。安装方法: pnpm install -g @musistudio/claude-code-router 配置 Claude Code 正常使用,直接登录即可。也可以参考某claude code镜像提供商家的代码 ...

2025-06-12 · 10 分钟 · czyt

懒猫微服开发简明教程

最近入手了懒猫微服,简单记录下开发相关的内容。 环境配置 先决条件 你必须有一台懒猫微服,购买地址 安装基本环境lzc-cli,请参考官方说明地址 如果你要发布程序,必须要申请成为懒猫微服开发者,申请地址 设备上必须安装懒猫开发者工具 应用。这个应用主要用来通过lzc-cli进入devshell容器的开发以及将本地的测试镜像推送到盒子进行测试。 开发机器上安装懒猫微服客户端,这和懒猫微服的网络机制有关,参考官方文档 。开启客户端并且设备需要联网开机。 如果上面的条件都已经满足,那么我们进入下一步。 不同类型应用的注意事项 Docker应用 对于公网的docker应用如果要使用,需要先进行copy-image来利用懒猫官方提供的镜像源,参考官方说明 。下面是我的一个执行例子: 我在没copy操作之前lzc-cli project devshell cmd: install --uid czyt --pkgId cloud.lazycat.app.gokapi Error: rpc error: code = Unknown desc = "time=\"2025-02-08T00:18:51+08:00\" level=warning msg=\"The \\\"LAZYCAT_APP_ID\\\" variable is not set. Defaulting to a blank string.\"\ntime=\"2025-02-08T00:18:51+08:00\" level=warning msg=\"The \\\"LAZYCAT_APP_DEPLOY_UID\\\" variable is not set. Defaulting to a blank string.\"\ntime=\"2025-02-08T00:18:51+08:00\" level=warning msg=\"The \\\"LAZYCAT_APP_DEPLOY_UID\\\" variable is not set. Defaulting to a blank string.\"\ntime=\"2025-02-08T00:18:51+08:00\" level=warning msg=\"The \\\"LAZYCAT_APP_DOMAIN\\\" variable is not set. Defaulting to a blank string.\"\ntime=\"2025-02-08T00:18:51+08:00\" level=warning msg=\"The \\\"LAZYCAT_APP_DEPLOY_UID\\\" variable is not set. Defaulting to a blank string.\"\ntime=\"2025-02-08T00:18:51+08:00\" level=warning msg=\"The \\\"LAZYCAT_APP_DEPLOY_UID\\\" variable is not set. Defaulting to a blank string.\"\ntime=\"2025-02-08T00:18:51+08:00\" level=warning msg=\"The \\\"LAZYCAT_APP_DOMAIN\\\" variable is not set. Defaulting to a blank string.\"\ntime=\"2025-02-08T00:18:51+08:00\" level=warning msg=\"The \\\"LAZYCAT_APP_ID\\\" variable is not set. Defaulting to a blank string.\"\n app Pulling \n gokapi Pulling \n a0bed814693a Already exists \n b4e16c7102ef Already exists \n b23adc163656 Pulling fs layer \n 99db376b5073 Pulling fs layer \n 5ed8719dcb50 Pulling fs layer \n 99db376b5073 Downloading [==================================================>] 251B/251B\n 99db376b5073 Verifying Checksum \n 99db376b5073 Download complete \n b23adc163656 Downloading [> ] 134.7kB/11.46MB\n 5ed8719dcb50 Downloading [> ] 265.8kB/23.48MB\n b23adc163656 Verifying Checksum \n b23adc163656 Download complete \n 5ed8719dcb50 Verifying Checksum \n 5ed8719dcb50 Download complete \n b23adc163656 Extracting [> ] 131.1kB/11.46MB\n b23adc163656 Extracting [======================> ] 5.243MB/11.46MB\n b23adc163656 Extracting [==================================================>] 11.46MB/11.46MB\n gokapi Error unknown: {\"errors\":[{\"code\":\"MANIFEST_UNKNOWN\",\"message\":\"manifest unknown\",\"detail\":{\"name\":\"f0rc3/gokapi\",\"revision\":\"v1.9.6\"}}]}\nError response from daemon: unknown: {\"errors\":[{\"code\":\"MANIFEST_UNKNOWN\",\"message\":\"manifest unknown\",\"detail\":{\"name\":\"f0rc3/gokapi\",\"revision\":\"v1.9.6\"}}]}\n" with exit status 18 Copy ...

2025-02-07 · 12 分钟 · czyt

一些chroot的小经验

gsettings自动设置 软件依赖 使用dpkg-repack和dpkg-deb 要将多个已安装的软件包打包成一个单独的包,可以使用 dpkg-repack 工具,这样可以在离线环境中轻松部署这些包。以下是具体步骤: 1. 安装 dpkg-repack 首先,确保在系统中安装了 dpkg-repack 工具: sh复制代码sudo apt-get update sudo apt-get install dpkg-repack 2. 重新打包已安装的软件包 假设你已经在系统上安装了一些软件包,比如 htop 和 vim。你可以使用 dpkg-repack 将它们重新打包成 .deb 文件: sh 复制代码 dpkg-repack htop vim 这样会生成两个 .deb 文件,htop.deb 和 vim.deb。 3. 使用 dpkg-deb 打包多个包 接下来,你可以使用 dpkg-deb 工具将这些 .deb 文件打包成一个压缩包,以便于离线传输和安装。 3.1 创建打包目录 创建一个目录来存放这些 .deb 文件: sh复制代码mkdir my_packages mv htop_*.deb my_packages/ mv vim_*.deb my_packages/ 3.2 创建 DEBIAN 目录和控制文件 创建 DEBIAN 目录和控制文件来描述这个新的包: sh 复制代码 mkdir -p my_packages/DEBIAN 创建一个控制文件 my_packages/DEBIAN/control,内容如下: ...

2024-06-21 · 1 分钟 · czyt

一些RustDesk部署的笔记

自建 Server 搭建中转服务器 参考官方 https://rustdesk.com/docs/en/self-host/rustdesk-server-oss/install/ 一些有用的链接: https://github.com/infiniteremote/installer/blob/main/install.sh 搭建api server api server是高级版的功能,但是我们可以通过自建api server实现设备id同步等部分操作。推荐使用: https://github.com/kingmo888/rustdesk-api-server https://github.com/sctg-development/sctgdesk-server 这个是带web console的用户名和密码分别是admin和Hello,world! https://github.com/lejianwen/rustdesk-server 更多的实现,可以去Github 搜一搜 https://github.getafreenode.com/topics/rustdesk-api-server 客户端自定义部署 基于Github Action 参考官方 https://rustdesk.com/docs/en/dev/build/all/ 对于arm版本的自动化构建,Github Action暂时不提供arm64的runner 基于配置文件和命令行 RustDesk有用的命令行参数 --password 可用于设置永久密码。 --get-id 可用于检索 ID。 --set-id 可用于设置ID,请注意ID应以字母开头。 --silent-install 可用于在 Windows 上静默安装 RustDesk。 RustDesk 配置文件 RustDesk的配置文件,windows为"%appdata%\RustDesk\config\RustDesk2.toml"linux则为~/.config/rustdesk/RustDesk2.toml,下面是一个完整的配置文件示例: 新版貌似会读取登录用户的目录下的,老的版本是修改root用户目录下的文件 rendezvous_server = 'rustdesk.xxxx.tech:21116' nat_type = 1 serial = 0 [options] # 对应安全选项->权限中的完全访问 access-mode = 'full' # 对应安全选项->安全->允许IP直接访问 direct-server = 'Y' # 对应安全选项->安全->自动关闭不活跃的会话 allow-auto-disconnect = 'Y' stop-service = 'Y' key = 'KEY' relay-server = 'rustdesk.xxxx.tech' api-server = 'https://IPADDRESS' custom-rendezvous-server = 'rustdesk.xxxx.tech' verification-method = 'use-permanent-password' # 只需要密码进行 approve-mode=password default-connect-password=abcd1234 完整文档参考 approve-mode ...

2024-05-17 · 1 分钟 · czyt

Windows ollama一些有用的批处理脚本

模型设置 模型路径设置 @echo off echo set models storage path to current Dir %~dp0models SETX OLLAMA_MODELS %~dp0models echo setup done timeout 5 这个脚本会将模型的存储路径放在批处理相同目录的models目录下 启动 一键启动ollam和对应模型 @echo off echo start ollama... start %~dp0ollama.exe serve echo boot model start %~dp0ollama.exe run phi3

2024-05-09 · 1 分钟 · czyt

系统设计101

本文使用AI自动翻译,原文仓库地址 用直观和简单的术语解释复杂的系统。 无论您是在准备系统设计面试,还是只是想了解系统在表面之下是如何工作的,我们都希望本资料库能帮助您实现这一目标。 通信协议 架构风格定义了应用程序编程接口(API)不同组件之间的交互方式。因此,它们通过提供设计和构建 API 的标准方法,确保了效率、可靠性以及与其他系统集成的便捷性。以下是最常用的样式: SOAP: 成熟、全面、基于 XML 最适合企业应用 RESTful: 流行、易于实施的 HTTP 方法 网络服务的理想选择 GraphQL: 查询语言,请求特定数据 减少网络开销,加快响应速度 gRPC: 现代化、高性能的协议缓冲器 适合微服务架构 WebSocket: 实时、双向、持久连接 非常适合低延迟数据交换 Webhook 事件驱动、HTTP 回调、异步 事件发生时通知系统 REST API 与 GraphQL 在应用程序接口设计方面,REST 和 GraphQL 各有优缺点。 下图显示了 REST 和 GraphQL 的快速比较。 REST 使用 GET、POST、PUT、DELETE 等标准 HTTP 方法进行 CRUD 操作。 当你需要在不同的服务/应用程序之间建立简单、统一的接口时,它就能很好地发挥作用。 缓存策略可以直接实施。 缺点是可能需要多次往返,从不同的端点收集相关数据。 GraphQL 为客户提供单个端点,以便准确查询所需数据。 客户端在嵌套查询中指定所需的确切字段,服务器只返回包含这些字段的优化有效载荷。 支持用于修改数据的突变和用于实时通知的订阅。 非常适合聚合多个来源的数据,并能很好地满足快速发展的前端需求。 不过,它将复杂性转移到了客户端,如果没有适当的保护措施,可能会允许滥用查询 缓存策略可能比 REST 更加复杂。 REST 和 GraphQL 之间的最佳选择取决于应用程序和开发团队的具体要求。GraphQL 非常适合复杂或频繁变化的前端需求,而 REST 则适合需要简单一致的合同的应用。 ...

2023-10-24 · 11 分钟 · czyt

一些windows定制的相关资源

脚本 移除Edge @echo off reg delete "HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Microsoft Edge" /v "NoRemove" /f >NUL 2>nul reg delete "HKLM\SOFTWARE\WOW6432Node\Microsoft\EdgeUpdate\ClientState\{56EB18F8-B008-4CBD-B6D2-8C97FE7E9062}" /v "experiment_control_labels" /f >NUL 2>nul reg add "HKLM\SOFTWARE\WOW6432Node\Microsoft\EdgeUpdateDev" /v "AllowUninstall" /t REG_DWORD /d 1 /f >NUL 2>nul for /D %%I in ("%ProgramFiles(x86)%\Microsoft\Edge\Application\*") do ( if exist "%%I\Installer\setup.exe" ( echo Uninstalling Edge Chromium pushd "%%I\Installer" setup.exe --uninstall --msedge --force-uninstall --system-level --delete-profile popd ) ) msiexec /X{2BFF39DC-EFF0-355C-80CD-41D847013784} /qn /norestart set "value=MicrosoftEdgeAutoLaunch_.*" set "path=HKCU\Software\Microsoft\Windows\CurrentVersion\Run" for /f "tokens=1,*" %%A in ('reg query "%path%" /f "Microsoft" ^| findstr /R "%value%"') do ( reg delete "%path%" /v "%%A" /f ) del /q /f "%userprofile%\Desktop\Microsoft Edge.lnk" >NUL 2>nul 注册表 安全 智能应用助理 打开 ...

2023-09-20 · 1 分钟 · czyt