聚合文章

汇集全部已收录博客的最新文章,点击标题前往原文阅读。

排序方式:最新发布

AI Agent 实战手记 04:给 Agent 选对 Loop 工作方式

同一个 Agent,为什么你只是聊聊天,别人却能让它通宵改完 40 个测试?差别通常在它的"工作方式"——专业点叫 Loop(循环)。上篇我们聊过权限模式(能动什么),这篇讲另一条线:循环方式(跑多远、怎么跑)。它决定 Agent 是回一句话就停,还是一轮一轮干到任务完成。 1. 什么是 Loop 工作方式(What) 1.1 一次循环是什么 Agent 最小的工作单位是"思考 → 调用工具 → 拿到结果",这算一次迭代(loop iteration)。普通对话里,Agent 回你一句就停;Loop 工作方式决定四件事: 跑几轮:一次就停,还是持续到完成。 怎么跑:单个 Agent 自己循环,…

用 kkFileView 搭一个文件在线预览服务

内网里堆着各种文档,docx、xlsx、pptx、pdf 混在一起。每次想快速看一眼内容,都要先下载、再装 Office 或 WPS,看完再删掉,纯属浪费时间。更别说分享给别人时,对方还得先问一句"你装 Office 了吗"。 kkFileView 解决的就是这个场景:一个容器跑起来,浏览器里直接预览文件。它内部靠 LibreOffice 把 Office 文档转成 PDF 或图片,前端再渲染出来,业务系统只要拼一个 URL 就能接入。 1. 选它的两个理由 1.1 格式覆盖广 这一点是最省事的地方——主流格式基本都在支持列表里: Office 全家桶:doc、docx、xls、xlsx、pp…

给 AI 派活:四份文档与一套验收标准

最近我把一整套开发活交给了一个 AI agent 干:9 个阶段、28 条验收标准、130 个自动化测试,前后几十次提交。整个过程里没有一句"你去写个 X 吧"式的口头指令,所有约定都躺在磁盘上的四份文档里。 这篇把这套方法和里面的术语讲清楚。它不需要什么高级工具,你手上有任何一个能执行命令、能写文件的 agent 就能用。 1. 为什么需要一套文档 1.1 它不记得你 跟 agent 协作,第一个要接受的事实是:它不记得你。 每次会话它都是重新醒来,上一次聊过什么、你定过什么规矩,只要没落进磁盘,就等于没发生。你昨晚花了二十分钟跟它讲清楚的接口命名规范,第二天开新会话,它一无所知。 这跟带新…

把浏览器扩展的数据同步到 GitHub:用代码仓库当云端存储

浏览器扩展的数据默认只躺在 chrome.storage.local 里,清理一次缓存、换一台电脑,就全没了。想做云备份,通常意味着自己运维一个服务,或者去注册某个第三方 BaaS。这篇拆一个更省事的做法:把 GitHub 私有仓库当云端存储,一份 JSON 快照对应仓库里的一个文件,每次上传就是一个 commit。而这个仓库不只是"某个项目的备份盘"——它是一个统一的数据存放位置,多个项目各写各的文件即可。 1. 为什么选 GitHub 先说结论:GitHub 不是"最适合"存业务数据的地方,但它是综合成本最低的地方。下面几个理由都是白拿的。 它是一个统一的数据存放位置。 仓库不是"某个项目…

Traditional vs Roth IRA under fixed amount of investment

I’ve read a lot of articles on Traditional vs Roth IRA. One can do a serious mathematical analysis of which one is better, given that you want to invest a total of x income into the account for a particular year. Money in excess of x will be put in a normal investment account. There is a widely held…

Word break with cost

Problem1 Given a set of strings W, a cost function c:W\to \R and a string s. Find elements w_1,\ldots,w_k\in W such that s=w_1\ldots w_k, and \sum_{i=1}^k c(w_i) is minimized. This problem is a generalization of the word break problem on leetcode. Many algorithms you see online assumes that each str…

Bounds on number of cuts

Consider we have an undirected graph G=(V,E) of n vertices, and there are positive cost c:E\to \R^+ on the edges. We define c(F)=\sum_{e\in F}c(e), to be the cost (value) of F\subset E. Let \mathcal{P} be a partition of V where each partition class is non-empty. We define E(\mathcal{P}) to be the se…

Maximize Cash Back

Credit cards often offers rewards for purchases. For example, a card that gives 5% cash back for grocery stores. Also, credit cards often can be used to buy gift cards for specific stores. For example, one can use Chase Ink Cash (CIC) and go to Staples and buy gift card for Amazon for effectively 7.…

The value of a gift card in beancount

I’m using beancount to do accounting. In beancount, you are allowed to have commodities. One can view gift card as commodity, but also as a currency. Say, I bought an $100 Amazon gift card for $90, I would write 100 AMAZON {0.9 USD}, which means 100 units of Amazon with unit cost $0.9. Later on, I u…

Yotta Savings and covering designs

Yotta Savings is a FDIC insured savings account that gives you “interest” in another way. It has a 0.2% APR. It is much better than the APR of many banks, but much worse than actual high APR savings accounts, e.g. Marcus, Ally. However, for each $25, Yotta gives you a ticket weekly to their drawing,…

Test conjectures on $k$-partitions over submodular functions

This article considers tools one can use to quickly test conjectures. I work in combinatorial optimization, and often there are cases where one can phrase a problem as a conjecture over a finite domain. Testing conjectures using brute force quickly becomes infeasible due to combinatorial explosion. …

The related employer controlled group

Disclaimer: Not an accountant nor a lawyer. For employees in the US, employers (not just the employee) can contribute to the employee’s retirement fund 401(k). There is an maximum limit. It is M = \$61,000 for 2022. If a person works for multiple unrelated employers, each employer, in theory, can co…

Use a box spread as a line of credit

In an idealized world, you could borrow at the Effective Federal Funds Rate (EFFR) and also earn roughly the same rate on cash deposits. For simplicity, assume the relevant short rate is fixed for a month. Let’s say it turns out to be 10% per month. Assume the stock will rise by 20% that month. In r…

AI Agents for the Working Mathematician

REVISED 2026-09-19. This is a living document. I revise it as the mathematical AI frontier changes and as experience with these systems changes what we know about using them for mathematics. The recommendations below describe current practice and will keep changing. Most working mathematicians I tal…