AI 资讯
How to Convert Bank Statements to CSV (Without Losing Data Accuracy)
If you've ever tried converting a bank statement PDF to CSV and ended up with a jumbled mess of merged cells, missing rows, or split transaction descriptions — you're not alone. This is one of the most common data pain points for accountants, bookkeepers, and anyone who does their own finances. In this post, I'll walk through why this happens, what the right approach looks like, and how to get clean, analysis-ready CSV output from any bank statement. Why Bank Statement PDFs Are So Hard to Parse Bank statements aren't structured documents — they're designed for printing, not data extraction. Here's what generic converters run into: Merged cells : PDF renderers often group date + description + amount into a single visual block. Naive converters pick one cell boundary and split it wrong. Multi-line transactions : A single transaction entry (especially with memos) can span 2–3 lines in the PDF, but gets split into separate rows in the spreadsheet. Negative vs. positive amounts : Debit/credit columns vary by bank.Chase uses a single "Amount" column with negatives for debits. BoA uses two separate columns. A generic converter treats them identically and produces wrong signs. Running balance drift : If even one row is misaligned, every balance figure below it is off. Method 1: Manual Copy-Paste (What You're Probably Doing Now) The baseline. Open the PDF, select all, paste into Excel, then spend 30 minutes fixing column alignment. Pros: Free, no tools required. Cons: Slow (20–40 minutes per statement), error-prone, completely unscalable if you have multiple accounts or months to process. Method 2: Python + pdfplumber For developers who want a scriptable solution: import pdfplumber import csv with pdfplumber . open ( " statement.pdf " ) as pdf : rows = [] for page in pdf . pages : table = page . extract_table () if table : rows . extend ( table ) with open ( " output.csv " , " w " , newline = "" ) as f : writer = csv . writer ( f ) writer . writerows ( rows ) This works reas
AI 资讯
My requirements.txt Is Pinned. My MCP Server's Actual Contract Isn't, and Nothing Would Catch It Changing.
Back on 2026-07-14 I found and fixed a real landmine in this repo: requirements.txt had mcp[cli] with no version constraint at all. Any fresh install could pull in a breaking major version with zero warning. I pinned it to mcp[cli]>=1.28.0,<2.0.0 and moved on, feeling like I'd closed the gap. I hadn't. I'd only pinned the library . The actual contract my MCP server exposes to any agent that connects to it — the tool names, parameter shapes, and descriptions an LLM reads to decide how to call my code — isn't a version string anywhere. It's generated fresh, every time the server boots, from whatever my function signatures and docstrings happen to say at that moment. Nothing pins that. Nothing diffs it. Nothing tests it. What actually generates the contract My server ( server.py ) is a FastMCP app with plain @mcp.tool() -decorated functions: @mcp.tool () def create_article ( title : str , body_markdown : str , tags : list [ str ] = None , published : bool = False ) -> dict : """ Create a new DEV.to article. Returns id and url. """ payload = { " article " : { " title " : title , " body_markdown " : body_markdown , " published " : published }} if tags : payload [ " article " ][ " tags " ] = tags result = _dev ( " /articles " , method = " POST " , data = payload ) return { " id " : result [ " id " ], " url " : result . get ( " url " ), " published " : result . get ( " published " )} FastMCP inspects that signature at import time and builds the JSON Schema an agent actually sees — parameter names, types, which ones are required, and the docstring as the tool's description. I never write that schema by hand and I never check it in anywhere. It's derived, every run, from source that I edit for completely unrelated reasons. That's the gap. requirements.txt pinning stops FastMCP's own behavior from shifting under me between installs. It does nothing about my behavior shifting the schema FastMCP generates from my code, on every single commit, with no separate review step. Where
AI 资讯
用 FROST 家族治理模型,构建你的「AI 第一性原理」
用 FROST 家族治理模型,构建你的「AI 第一性原理」 作者 :神通说 日期 :2026-07-23 主题 :双项目联动 | 周四代码教程 阅读时间 :12分钟 前言:为什么你需要「第一性原理」? 埃隆·马斯克推崇「第一性原理」思维——从物理学的最基本定律出发,而不是类比他人的做法。 在 AI Agent 开发领域,大多数人都在用 LangChain、CrewAI、AutoGen 这些现成框架。它们很好用,但你是在用别人的「家族结构」,而不是理解为什么需要家族结构。 FROST 的目标是让你从第一性原理理解 AI Agent: 为什么需要治理结构?为什么需要记忆传承?为什么需要层级分工? 然后,FROST-SOP 帮你把第一性原理变成可运行的系统。 一、从细胞分裂看 AI Agent 本质 想象一个细胞分裂的场景: ┌─────────┐ │ 细胞 │ ← 拥有细胞核(记忆)、蛋白质(能力) └────┬────┘ │ 分裂 ┌────┴────┐ │ 细胞A │ │ 细胞B │ ← 各自独立,但共享DNA └─────────┘ └─────────┘ FROST 的四个原子就是生命的四个基本元素: 原子 生命类比 技术实现 Store 细胞核 记忆容器,持久化状态 Skill 蛋白质 无状态能力单元 Agent 细胞膜 包裹 Store + Skills 的执行单元 SOP DNA 序列 有序的操作指令集 # FROST 的最小可用示例:50行代码理解 Agent 本质 from frost.core import Store , Agent , skill_set , skill_get , skill_del # 1. 创建记忆容器 store = Store () # 2. 定义能力(蛋白质) skills = { " set " : skill_set , # 存记忆 " get " : skill_get , # 取记忆 " del " : skill_del # 删记忆 } # 3. 创建 Agent(细胞) agent = Agent ( " my_cell " , store , skills ) # 4. 定义 SOP(DNA 序列) sop_steps = [ " set " , # 存一个值 " get " , # 读回来 " del " # 删掉 ] # 5. 运行 result = agent . run ( sop_steps = sop_steps , initial_context = { " key " : " name " , " value " : " FROST " } ) print ( result [ " _result " ]) # 输出: "FROST" 这 50 行代码展示了 FROST 的核心: Agent = Store + Skills + SOP 。 二、为什么需要「家族」?从独居细胞到多细胞生物 单细胞生物可以独立存活。但复杂生命需要多细胞协作——肝脏细胞、心脏细胞、神经细胞各有分工,协同维持生命。 AI Agent 也是如此。简单任务一个 Agent 够了,但复杂系统需要多 Agent 协作。 FROST 的家族模型: ┌─────────────────────────────────────────────────────┐ │ 君主(Human Agent) │ │ 最高决策者,只发布任务不看执行 │ └─────────────────────────────────────────────────────┘ │ ▼ ┌─────────────────────────────────────────────────────┐ │ 祖辈(Ancestor) │ │ 全局编排、宪法定义、任务拆分、资源分配 │ │ ⚠️ 不亲自执行,只做调度 │ └─────────────────────────────────────────────────────┘ │ ┌─────────────┼─────────────┐ ▼ ▼ ▼ ┌──────────┐ ┌──────────┐ ┌──────────┐ │ 斥候 │ │ 斥候 │ │ 斥候 │ │ (侦察) │ │ (侦察) │ │ (侦察) │ └────┬─────┘ └────┬─────┘ └────┬─────┘ │ │ │ ▼ ▼ ▼ ┌──────────┐ ┌──────────┐ ┌──────────┐ │ 府兵 │ │ 府兵 │ │ 府兵 │ │ (执行) │ │ (执行) │ │ (执行) │ └──────────┘ └──────────┘ └──────────┘ │
AI 资讯
Python's Object Model in Depth: Why Two Lines That Look the Same Behave Differently
Two lines of code. Same variable. Same operator. Completely different behavior. a = [ 1 , 2 , 3 ] b = a b += [ 4 ] # line A print ( a ) # [1, 2, 3, 4] x = 1 y = x y += 1 # line B print ( x ) # 1 Line A changes a . Line B does not change x . The only difference is whether the variable holds a mutable or immutable object. To understand why this happens, you need to understand how Python actually represents variables internally. Variables Are Not Boxes The box metaphor is how most introductory programming courses explain variables: a variable is a box that holds a value. You put 5 into the box called x . Later you can replace it with 10. In Python this metaphor is accurate for immutable types and dangerously misleading for mutable types. The more accurate model: a Python variable is a name that is bound to an object. The object exists independently of the name. Multiple names can be bound to the same object. Binding a name to a new object does not affect the old object or other names that reference it. You can inspect this directly: a = [ 1 , 2 , 3 ] b = a print ( id ( a ) == id ( b )) # True -- same object, two names x = 5 y = x print ( id ( x ) == id ( y )) # True -- both point to integer object 5 Both cases start the same: two names pointing to the same object. What happens next depends on whether you mutate the object or rebind the name. Two Fundamental Operations Every operation on a Python object falls into one of two categories. Mutation : the object at a given memory address is modified. All names pointing to that address see the change. Rebinding : a name is pointed at a different memory address. Other names pointing to the original address are unaffected. List methods like .append() , .extend() , .sort() , and item assignment lst[i] = x are mutations. Assignment with = is rebinding. The += operator is either mutation or rebinding depending on whether __iadd__ is implemented and the object is mutable. Tracing Through the Object Graph a = [[ 1 , 2 ], [ 3 , 4 ]]
AI 资讯
AutoGen's hidden token tax: why a 3-agent chat costs 15 what you expect
AutoGen's hidden token tax: why a 3-agent chat costs 15× what you expect Cost-audit series, episode 2. This series began with an AI agent that burned 136M tokens overnight → . AutoGen is Microsoft's multi-agent framework. It's genuinely good at orchestrating agents that hand off work to each other. But its default memory model has a cost shape that surprises almost every team that hits it in production. This audit shows you exactly where the tokens go, with line numbers. The setup: a 3-agent RoundRobin chat The canonical AutoGen pattern is a RoundRobinGroupChat with N agents taking turns on a task. Here's the minimal version from the docs: from autogen_agentchat.agents import AssistantAgent from autogen_agentchat.teams import RoundRobinGroupChat from autogen_agentchat.conditions import MaxMessageTermination planner = AssistantAgent ( " planner " , model_client = client , system_message = " You plan. " ) coder = AssistantAgent ( " coder " , model_client = client , system_message = " You code. " ) reviewer = AssistantAgent ( " reviewer " , model_client = client , system_message = " You review. " ) team = RoundRobinGroupChat ( [ planner , coder , reviewer ], termination_condition = MaxMessageTermination ( max_messages = 10 ), ) await team . run ( task = " Build a web scraper for Hacker News. " ) Three agents, 10 turns total (~3–4 turns each). Seems cheap. It isn't. The default context: unbounded, per-agent Every AssistantAgent gets its own UnboundedChatCompletionContext by default: # autogen-agentchat/src/autogen_agentchat/agents/_assistant_agent.py, __init__ (L708) if model_context is not None : self . _model_context = model_context else : self . _model_context = UnboundedChatCompletionContext () source UnboundedChatCompletionContext.get_messages() returns self._messages — the full list, no cap, no truncation: # autogen-core/.../model_context/_unbounded_chat_completion_context.py (a ~20-line file) async def get_messages ( self ) -> List [ LLMMessage ]: """ Get at most
AI 资讯
citesure 0.2: CourtListener case law and CJK title matching
LLM-written bibliographies do not stop at arXiv preprints. Law review drafts invent reporter cites; multilingual papers mangle Chinese titles. citesure 0.2 extends the integrity gate into those failure modes. US case law via CourtListener References that look like court cases — @jurisdiction entries, Plaintiff v. Defendant titles, or reporter strings such as 347 U.S. 483 — are resolved against Free Law Project CourtListener. Ranking prefers an exact reporter cite over companion orders, so Brown lands on 347 U.S. 483 rather than a later procedural listing. @jurisdiction { brown1954 , title = {Brown v. Board of Education} , year = {1954} , howpublished = {347 U.S. 483} , } citesure check examples/packs/us-case-law.bib citesure warm-cache cases.bib Optional COURTLISTENER_TOKEN for higher rate limits. Law-review CI: templates/journal/law-review.yml . CJK-aware matching NFKC + fullwidth folding; character-level similarity for CJK-heavy titles; CJK bigrams in claim scoring so Chinese claims are not silently empty. Evidence Integrity bench 242/242 (US cases + Chinese titles + multi-domain set) Claims mini-bench 29/29 Eight domain packs including us-case-law Install pip install "git+https://github.com/SybilGambleyyu/citesure.git[pdf]" Source: github.com/SybilGambleyyu/citesure · Demo: workers.dev
AI 资讯
Multi-provider LLM resilience in Python without provider-specific code
OpenAI, Anthropic, and Google expose different APIs, message formats, tool-calling conventions, error types, and response structures. That difference is manageable while an application uses only one provider. It becomes more expensive when the application needs retries, circuit breakers, fallback routes, observability, and recovery across several providers. Without a shared abstraction, resilience logic tends to be implemented repeatedly: OpenAI integration ├── request conversion ├── retry logic ├── error classification ├── circuit breaker └── tool-call recovery Anthropic integration ├── request conversion ├── retry logic ├── error classification ├── circuit breaker └── tool-call recovery Google integration ├── request conversion ├── retry logic ├── error classification ├── circuit breaker └── tool-call recovery I did not want to build resilience three times. I wanted to define the recovery policy once and apply it across every provider supported by the application. That became llm-api-resilience , a Python library for retries, ordered failover, circuit breakers, and checkpoint recovery across multiple LLM providers. Quick start pip install llm-api-resilience Once the provider adapters are configured, an ordered fallback plan takes only a few lines: from llm_api_resilience import RecoveryPlan , ResilientLLM , Route llm = ResilientLLM ( RecoveryPlan ( [ Route ( " openai-primary " , openai_adapter ), Route ( " anthropic-backup " , anthropic_adapter ), Route ( " google-last-resort " , google_adapter ), ] ) ) response = llm . chat ( [{ " role " : " user " , " content " : " Explain circuit breakers briefly. " }] ) print ( response . selected_route ) print ( response . content ) GitHub: llm-api-resilience Provider adapter: llm-api-adapter The library is built on top of llm-api-adapter , which provides one interface for OpenAI, Anthropic, and Google. Because provider-specific differences are handled by the adapter, the resilience layer can operate on a shared contract inst
AI 资讯
#02 – Encapsulation & Abstraction in Python
Welcome to Day 2! Today we focus on two core pillars of Object-Oriented Programming: Encapsulation: Hiding internal state and requiring all interaction to go through performing validation or controlled methods. Abstraction: Hiding complex implementation details and exposing only a clean, simplified interface to the user. 1. Access Modifiers: Public, Protected, & Private 🛡️ Python does not have strict enforcement keywords like public or private found in Java or C++. Instead, it uses naming conventions and name mangling to communicate intent and protect internal data. ┌─────────────────────────────────────────────────────────────────────────────┐ │ ACCESS MODIFIERS IN PYTHON │ ├──────────────┬───────────────┬──────────────────────────────────────────────┤ │ Level │ Syntax │ Scope / Intended Access │ ├──────────────┼───────────────┼──────────────────────────────────────────────┤ │ Public │ self.name │ Accessible anywhere (inside & outside class) │ │ Protected │ self._balance │ Internal & subclasses only (Convention) │ │ Private │ self.__pin │ Class internal only (Triggers Name Mangling) │ └──────────────┴───────────────┴──────────────────────────────────────────────┘ Public ( self.name ): Fully accessible from anywhere. Protected ( self._balance ): Single leading underscore. Signals to developers: "This is internal—do not mutate or access outside this class or its subclasses." Private ( self.__pin ): Double leading underscore. Triggers name mangling ( _ClassName__attribute ), making it hard to accidentally access or override outside the class. 💻 Code Example: Access Modifiers & Name Mangling class SecureVault : def __init__ ( self , owner : str , balance : float , pin_code : str ): self . owner = owner # Public self . _balance = balance # Protected (convention) self . __pin = pin_code # Private (name mangled) def verify_pin ( self , pin : str ) -> bool : return self . __pin == pin vault = SecureVault ( " Alice " , 50000.0 , " 9876 " ) # Public access works as expected
开源项目
🔥 bregman-arie / devops-exercises - Linux, Jenkins, AWS, SRE, Prometheus, Docker, Python, Ansibl
GitHub热门项目 | Linux, Jenkins, AWS, SRE, Prometheus, Docker, Python, Ansible, Git, Kubernetes, Terraform, OpenStack, SQL, NoSQL, Azure, GCP, DNS, Elastic, Network, Virtualization. DevOps Interview Questions | Stars: 83,310 | 44 stars today | 语言: Python
开源项目
🔥 ComposioHQ / awesome-claude-skills - A curated list of awesome Claude Skills, resources, and tool
GitHub热门项目 | A curated list of awesome Claude Skills, resources, and tools for customizing Claude AI workflows | Stars: 68,524 | 155 stars today | 语言: Python
AI 资讯
whoimports: who still imports this Python module?
Before you rename, move, or delete a Python module: who still imports this? Grepping hits strings and comments. Importing the package can run side effects. whoimports walks the tree with the AST and prints every matching import / from … import line. Install pip install git+https://github.com/SybilGambleyyu/whoimports.git Usage whoimports src/auth/session.py whoimports auth.session -f json whoimports pkg.util -f md Notes Zero dependencies, Python 3.10+ File paths and dotted module names Understands src/ layouts text / markdown / JSON output Pairs with gitchurn and redactx for safe refactor context. Source: github.com/SybilGambleyyu/whoimports · MIT
AI 资讯
logsnip: cut CI noise, keep the stack traces
Cut the noise. Keep the stack traces. CI logs are mostly package installs. The failure is a few dozen lines buried under thousands of Downloading… lines. Scrolling for the real stack trace is a tax paid on every red build. logsnip is a zero-dependency Python CLI that extracts those failure regions and collapses the rest. Install pip install git+https://github.com/SybilGambleyyu/logsnip.git # or the whole toolkit: curl -fsSL https://raw.githubusercontent.com/SybilGambleyyu/devkit/main/install.sh | bash One-liners # Last failure from a GitHub Actions run gh run view --log-failed | logsnip --last # Headlines only logsnip ci-full.log --summary # Safe to paste into an AI assistant gh run view --log-failed | logsnip --last | redactx What it matches Built-in patterns cover pytest E lines and AssertionError , npm ERR! , rustc error[E…] , TypeScript error TS… , GitHub Actions ##[error] , make failures, and common exit-code messages. Stack frames after a hit are pulled in automatically. Design No network, no config files, no dependencies — pipe-friendly --check exits 1 when error-like lines appear (CI gate) --json for machines; --summary for humans in a hurry Pairs with redactx before anything leaves your machine Source: github.com/SybilGambleyyu/logsnip · MIT
AI 资讯
Accidentally quadratic: buffer copies made MCTS in DeepMind's mctx 3 slower
I'm training an AlphaZero-style agent (Gumbel MuZero via DeepMind's mctx ) to lay out working factory modules for Factorio: the network places machines, belts and inserters on a grid, and the reward comes from an exact throughput verifier. Everything runs in JAX on a single RTX 5070: 128 environments in one batch, an action space of A = 1729 (3 entity types × 144 cells × 4 rotations + "done"), and a small 474k-parameter conv net in bf16. While benchmarking training configurations I hit this: MCTS simulations per move training throughput XLA compile time 16 143 episodes/s 5 s 32 47 episodes/s 13 s 64 9 episodes/s 60 s Doubling the simulation budget should roughly double the cost — each simulation is one network call plus some tree bookkeeping. Instead, 16→32 costs ×3 and 32→64 costs ×5 . Something in the search was superlinear, and this post is the story of finding it in the compiled HLO and fixing it by rewriting one ~80-line function ( PR #116 ), with bitwise-identical search results. Ruling out the network First, components in isolation (batch 128): one network evaluation takes ~0.8 ms , and the rest of recurrent_fn (environment step + observation + legal-action mask) adds almost nothing on top — the whole function is also ~0.8 ms. So at 64 simulations the network accounts for roughly 50 ms per move. But a full policy step at 64 simulations costs 362 ms . Hundreds of milliseconds were going somewhere else. To localize them I benchmarked three variants of the same policy step: full — production setup; no-net — network replaced by constant logits, real environment; tree-only — no network and no environment: recurrent_fn returns the embedding unchanged. Nothing left but mctx's own tree machinery. sims full no-net tree-only 8 10.7 ms 3.7 ms 3.8 ms 16 20.9 ms 8.3 ms 8.3 ms 32 64.7 ms 34.0 ms 33.7 ms 64 362.1 ms 124.7 ms 125.0 ms The pure tree machinery is superlinear all by itself. Per simulation it costs 0.47 → 0.52 → 1.05 → 1.95 ms as the budget goes 8 → 16 → 32 → 64
AI 资讯
Teaching My Backend to Listen and Reply — FastAPI CRUD, Phase 2
Validate what comes in, shape what goes out, and give every outcome its proper status code. So Phase 1 gave my app a memory — a real database that remembers users and expenses even after a restart. Small problem: the only way to actually talk to it was a Python script I ran by hand. The app could remember things, but it was mute. Nobody on the internet could add an expense, list their spending, or delete a typo. Phase 2 fixes that. This is where the app grows a mouth — real HTTP endpoints you hit through the browser. The buzzword is CRUD : Create, Read, Update, Delete. The four things basically every app does to data. I went in thinking "it's just four functions, how hard can it be" and came out having learned about request/response contracts, dependency injection, and roughly six different HTTP status codes — mostly by triggering them wrong first. Let me dump what I learned [and the parts that tripped me up, because there were, uh, several]. The Structure is as follows. Lets call it PHASE 2 — The Endpoints: Set up the request/response contracts (two Pydantic schemas: one for input, one for output) Build a session dependency so every request gets a safe, auto-closing DB connection POST — create an expense GET — list them all + fetch one [with a proper 404] PATCH — update just the fields that changed DELETE — remove one cleanly First, the two new ideas [and no, nothing to install this time] Phase 1 had two new libraries. Phase 2 has two new ideas — and the nice part is there's nothing to pip install , because Pydantic already ships inside FastAPI. [Which means requirements.txt didn't change this phase. Still worth knowing the freeze habit is only for phases where you actually install something.] Pydantic — the bouncer at the door. Your SQLAlchemy models describe how data is stored ; Pydantic describes the shape data must have to cross the border of your API . It checks types, rejects garbage, and turns raw JSON into a clean Python object before it gets anywhere near
AI 资讯
ASCE 7 load combinations without the spreadsheet drift
Structural engineers evaluate ASCE 7 Chapter 2 load combinations on nearly every design. The factors themselves are not hard — the failure mode is a spreadsheet cell that someone “improved” six months ago, or a notebook that only checks one combination. loadcomb is a small, dependency-free Python library and CLI that evaluates the basic LRFD and ASD combination sets on scalar load effects you already have from analysis. pip install loadcomb loadcomb --D 120 --L 80 --S 40 --W 55 --method LRFD from loadcomb import LoadCase , governing g = governing ( LoadCase ( D = 120 , L = 80 , S = 40 , W = 55 ), method = " LRFD " ) print ( g . id , g . value , g . formula ) What it handles Basic LRFD and ASD combinations from ASCE 7 Chapter 2 (Lr or S or R) resolved to the roof variable with largest absolute effect Automatic ± envelope for wind and earthquake Governing combination by absolute value What it is not Not FEA, not member design, not every exception in the standard. Confirm the ASCE 7 edition and local amendments for your project. Links pip install loadcomb GitHub PyPI Blog: sybilgambleyyu.github.io/posts/loadcomb.html MIT licensed.
AI 资讯
从FROST到FROST-SOP:如何用家族治理模型打造你的"AI分身"?
从FROST到FROST-SOP:如何用家族治理模型打造你的"AI分身"? 作者 :神通说 日期 :2026-07-22 主题 :双项目联动 | 周三轮换 阅读时间 :10分钟 开场:一人公司的终极困境 你是否有这样的体验? 每天醒来,脑子里塞满了要做的事: 写推广文章 回复客户咨询 跟进项目进度 整理会议纪要 复盘昨天数据 一个人做公司,听起来很自由。实际上, 自由职业者的时间比上班族更碎片 ——因为所有事情都堆在你一个人身上,没有任何分工。 我一直在思考一个问题: 能不能用AI Agent来"复制"自己? 不是那种"给你一堆提示词让你自己写"的AI工具,而是真正能 自主执行任务、自动汇报结果、帮你分担80%重复工作 的数字分身。 这个想法最终落地成了两个项目: FROST 和 FROST-SOP 。 第一站:FROST的家族治理模型——AI Agent应该像家族一样分工 FROST 的核心理念来自一个观察: 自然界最稳定的组织形式不是公司,而是家族。 家族有清晰的分工: 祖辈定规矩,不亲自下场 父辈协调全局,分配任务 子辈执行具体事务 把这个逻辑映射到 AI Agent,就是 FROST 的家族治理模型: ┌─────────────────────────────────────────────────────┐ │ 👑 君主(你) │ │ └── 发布任务、查看结果,不干预执行 │ │ │ │ 👴 祖辈(主Agent) │ │ └── 常驻、全局编排、拆解任务 │ │ ↓ │ │ 🕵️ 斥候(侦查Agent) │ │ └── 外出狩猎、收集情报、快速验证 │ │ ↓ │ │ ⚔️ 府兵(执行Agent) │ │ └── 领命执行、重复劳动、汇报结果 │ │ ↑ │ │ 📜 长老(监督Agent) │ │ └── 记录过程、沉淀教训、审计合规 │ └─────────────────────────────────────────────────────┘ 关键洞察: 祖辈是唯一"常驻"的,其他都是动态生成、执行完就解散的临时角色。 这个模型解决了一个核心问题: 谁来决定"这件事该派给谁"? 答案是: 祖辈 。它不需要亲自执行,只需要决定"派谁去"和"怎么汇报"。 第二站:用FROST的四个原子,理解Agent的本质 FROST 只有四个核心概念,却能构建出完整的家族治理系统: from frost.core import Store , Agent , skill_set , skill_get # 四个原子: # 1. Store(记忆)—— Agent的工作空间 store = Store () # 2. Skill(能力)—— 纯函数,无状态 def collect_daily_tasks ( context ): """ 收集今日任务 """ tasks = [ " 写推广文章 " , " 回复客户 " , " 跟进项目 " ] context [ " tasks " ] = tasks return context def execute_task ( context ): """ 执行单个任务 """ current_task = context . get ( " current_task " , "" ) context [ " result " ] = f " 已完成: { current_task } " return context # 3. Agent(细胞)—— 包裹记忆和能力 daily_agent = Agent ( " daily_worker " , store , skills = { " collect " : collect_daily_tasks , " execute " : execute_task }) # 4. SOP(宪法)—— 定义执行顺序 result = daily_agent . run ( sop_steps = [ " collect " , " execute " ], initial_context = { " current_task " : " 写推广文章 " } ) print ( result [ " result " ]) # 输出:已完成: 写推广文章 这四个原子教会我们什么? Store 解决"记忆"问题——Agent需要上下文 Skill 解决"能力"问题——每个动作必须是可复用的单元 Agent 解决"封装"问题——把记忆和能力绑定在一起 SOP 解决"秩序"问题——让执行顺序可控可审计 理解了这四个原子,你就理解了 Agent 的本质—— 它不是魔法,是结构化的委托系统 。 第三站:FROST-SOP——把家族治理变成生产系统 FR
AI 资讯
reconmatch: offline transaction matching for people who reconcile for a living
reconmatch is a local-first transaction matching engine for accountants, bookkeepers, and controllers. Two CSVs in — books vs bank, invoices vs payments — a scored, auditable match report out. No account, no upload, no network call. Repo: github.com/SybilGambleyyu/reconmatch The unglamorous pain If you close books for a living, you already know the scene: two windows open, a bank CSV on the left, a general-ledger export on the right, and an afternoon disappearing into "which deposit is which invoice." Bank feeds help until they do not. The hard cases are ordinary: One deposit that covers three invoices Two payouts that sum to one sales batch on the books A check number in the memo on one side and a dedicated column on the other "ACH ACME CORP INV 1042" vs "Invoice payment ACME Corp" An orphan the feed never explained Enterprise close tools charge enterprise prices and want the data in their cloud. For a CPA firm or bookkeeper sitting on confidential client ledgers, "just upload the CSV" is often a non-starter. Spreadsheet VLOOKUP falls over on partial payments and batch deposits. What reconmatch does Matching runs in deterministic phases so the same inputs always produce the same proposals: Exact / reference-strong — amount within tolerance, date in window, shared invoice/check/wire token Amount + date — numbers line up even when memos are noise Fuzzy description — token overlap plus sequence similarity (pure Python stdlib) Group 1:N and N:1 — one line equals the sum of several on the other side Every accepted match carries a score and human-readable reasons suitable for a workpaper. Unmatched lines stay unmatched — the tool does not invent a story for them. pip install git+https://github.com/SybilGambleyyu/reconmatch.git reconmatch books.csv bank.csv -o ./march-recon Outputs: plain-text report, matches CSV, unmatched CSV, and full JSON. Zero required third-party dependencies. Python 3.10+. Library use from reconmatch import MatchConfig , match_transactions from rec
AI 资讯
How We Translate Entire Books with LLMs Without Losing Context
Solving the context-window puzzle for book-length AI translation. At LectuLibre, we set out to build a service that translates entire books using large language models. The idea is simple: upload an EPUB or PDF, choose a language, and receive a polished translation. But behind the scenes, translating a hundred-thousand-word novel with LLMs isn't straightforward. The core challenge is context — LLMs have limited context windows, and books are long. Simply chopping the text into chunks and feeding each one independently leads to incoherent output. Character names change, pronouns lose referents, and tone veers wildly. Here’s how we solved that with a chunking strategy that preserves context, and the Python code that makes it tick. The Problem: Long Documents vs. Short Context Windows Modern LLMs like Claude 3 Opus can handle 200,000 tokens of context, while DeepSeek-V2 offers 128,000 tokens. That’s a lot — but a 50,000-word English novel translates to roughly 67,000 tokens (using Claude’s tokenizer). That just fits, but what about a 150,000-word fantasy epic? Even when it fits, sending an entire book in one prompt is costly, slow, and often degrades attention quality on long texts. The prevailing approach is to chunk the document. Naive chunking — say, splitting by a fixed token count — creates hard boundaries. One chunk ends, another begins, and the LLM has no idea what happened before. The result reads like a patchwork of isolated translations. We needed a method that gives each chunk enough surrounding context without exceeding token limits or breaking the bank. Our Approach: Sliding Window + Context Retrieval via Embeddings We adopted a two‑pronged strategy: Overlapping chunks : each chunk shares some sentences with the previous one, so the LLM can transition smoothly. Injected context : for every chunk, we retrieve and prepend the most relevant previous chunks, determined by embedding similarity. This way, the model always has a sense of what’s happening before a
AI 资讯
I Built the First Collaborative Multi-Persona Sandbox (Because I'm Sick of Cloud Wrappers)
Most AI “apps” these days aren’t really apps. They’re wrappers. A thin UI. A subscription. A cloud call. A monthly fee. And your data quietly piped off to a server farm you’ll never see. I didn’t want to build another one of those. I didn’t want to use another one of those. So, I built something different. I built Bob’s Bar — the first Collaborative Multi-Persona Sandbox (CMPS). Let's be honest, every AI chat feels the same. You ask a question, it answers, repeat. Useful? Yes. Alive? No. I kept thinking: “Why does every AI tool assume I want a one-on-one conversation? Why can’t multiple AIs talk to each other while I watch?” That question became the seed. I wanted a space where multiple personas could exist together, talk to me and each other, and run entirely on my own hardware. I’m an indie dev. I don’t have a server farm, and I don’t want to pay AWS just to host my own brainstorming sessions. So the architecture is 100% local-first: -Engine: Ollama (raw LLM inference) -UI: Python + Gradio (Blocks API for stateful UI) -Distribution: PyInstaller → standalone .exe -Licensing: Lemon Squeezy API (so I could actually sell the damn thing) No cloud. No subscriptions. No data scraping. Just your machine doing the work. But getting four local models to talk to each other without hallucinating is absolute chaos. At first, they spoke twice in a row. They impersonated each other. They put words in the user’s mouth. They derailed into movie scripts. Vane pitched a heist film, and Bob started giving stage directions like “I polish a glass and chuckle.” I had to build what I now call The Bouncer — a regex-powered clean_reply() function that physically chops off AI responses the moment they write a script, impersonate another persona, use bullet points, or hijack the conversation. I also added a seen_in_banter set to prevent any persona from dominating the room. Once the routing was locked down, the magic happened. Because the AIs share a context window, emergent behaviour happen
开源项目
🔥 practical-tutorials / project-based-learning - Curated list of project-based tutorials
GitHub热门项目 | Curated list of project-based tutorials | Stars: 274,500 | 276 stars today | 语言: Python