章鱼总结
00:00 / 08:53

Matt Pocock · 08:53

There's this technique that I've been using for a while that I thought was kind of just too boring and obvious to post about. And then in an office hours in the cohort I was running this week, I just showed it off and people went, wow, that's really cool. I never thought it could be so simple. And then I posted about it on Twitter and it went nuts. So obviously this is something people need to hear about. And this technique solves a problem which is how do you work with agents in multiple repos at once? So let's set this up. Imagine that your organization looks like this, which most organizations do. they have lots of different repos that all have different concerns. we have one that is a storefront, one that is a payments api, one that's an admin dashboard, and 20 more repos that you might occasionally need to dip in and out of. this is easy when you need to make changes to only one of these repos, so you just run the agent inside the storefront. it's even pretty easy if you realize when you're working in the storefront you need to make changes to the payments api because you can actually just get your agent to work in multiple directories at once. and so this means that you would end up with a pull request inside acme storefront and then a pull request inside payments api all from the same session. now that's fine and that works, but the issue becomes what do you do with the data.

我一直在用一种技巧,但之前觉得它太无聊、太显而易见,不值得发帖。 结果这周我在主办的学员班答疑时间里展示了它,大家都说:哇,这太酷了。 我从没想到它可以这么简单。 后来我在 Twitter 上发了帖子,反响非常热烈。 所以显然,这是大家需要了解的东西。 这项技巧解决的问题是:如何同时在多个代码仓库中使用智能体? 那我们先把场景搭起来。 设想你的组织是这样的,大多数组织都是如此。 它们有很多不同的代码仓库,各自关注不同的内容。 我们有一个是店面,一个是支付 API,一个是管理后台,还有另外 20 个仓库,你可能偶尔需要进去看看。 如果你只需要修改其中一个仓库,这很简单,直接在店面仓库里运行智能体就行。 如果你在店面仓库工作时发现还需要修改支付 API,那也还算容易,因为你可以让智能体同时在多个目录中工作。 这样,你就能在同一个会话中,分别在 acme 店面仓库和支付 API 仓库里提交两个拉取请求。 这没问题,也能正常工作,但问题在于:这些数据该怎么处理?

With the steering files and with the stuff that you want the agent to have in every single session, what often happens is you will have your skills and your tooling and your agents dot MD and maybe even like wiki links and stuff all inside duplicated over multiple repos. This means that whenever you start an agent session, you are going to have access to those things. So if you start in storefront, you're going to still have the same skills and tooling. But this is a massive pain because you then need to keep all of those skills, all of that tooling in sync across different repos and across maybe thirty, forty repos. You could put all of this skills and tooling inside people's local machines, so in their user directory, so it's accessible from every single one of these repos. But then because it's kind of invisible to the user, it means that they won't be updated over time and they'll probably fall behind what the global setup is. And also, I think of the user's directory as the place where the user can make changes to their setup. That suits how they work instead of how the team wants them to work. And so none of these solutions particularly feel great.

对于那些转向文件,以及你希望智能体在每个会话中都具备的内容,常见的情况是:你的技能、工具、agents.md,甚至是 wiki 链接等,都在多个仓库中重复存放。 这意味着每次启动智能体会话时,你都能访问这些内容。 所以如果你从店面仓库启动,仍然会拥有同样的技能和工具。 但这非常麻烦,因为你必须让所有这些技能和工具在不同仓库之间保持同步,而仓库可能有三四十个。 你可以把这些技能和工具放在每个人的本地机器上,也就是放在用户目录下,这样每个仓库都能访问到。 但由于这对用户来说几乎是不可见的,它们随着时间推移不会被更新,很可能会落后于全局配置的版本。 另外,我认为用户的目录是用户可以对自己的设置进行更改的地方。 这符合他们的工作方式,而不是团队希望他们采用的工作方式。 因此,这些方案都不是特别理想。

And it means that people who work in multi-repo setups feel like they have no good choices. And so the solution that I propose is called the home repo. This is a technique I've been using for a while where I have a single repo, so which is the home, where all of my skills, all my steering files, I have a wiki in there and a load of custom tooling, all that live in that one repo. This means that whenever I run my agent, I am running my agent always inside the home repo. That means that the agent operating inside the home repo, which is just like a normal repo, is able to reach the storefront and the payments API and just operate across lots of different repos at once and pull in all the context that it needs to. And so you're probably thinking, please, can we look at your home repo?

这也意味着,在多仓库环境中工作的人会觉得自己没有好的选择。 所以我提出的解决方案叫做"主仓库"(home repo)。 这是我使用了一段时间的一种技术:我只有一个仓库,也就是"主仓库",我所有的技能、所有的引导文件、一个维基,以及大量自定义工具,都存放在这一个仓库中。 这意味着,每当我运行智能体时,我总是在主仓库内部运行它。 这意味着在主仓库内运行的智能体,就像在一个普通仓库中一样,能够访问店面和支付API,并能同时跨越许多不同的仓库进行操作,获取它所需的全部上下文。 所以你可能在想,请让我们看看你的主仓库吧?

Well, here it is. The main things we need to pay attention to in here are, of course, the Claude. md inside here, which we'll get to in a minute. But also crucially, the skills up the top here. So include skills. These skills are private skills. In other words, these are skills that I do not want to release for whatever reason because they are extremely good and extremely sensitive to my business. And this means that these are available in every single session. So if your organization has a list of skills that you want to add, then you should add them inside the home repo just here. This is also a place that you can configure settings in a versioned way too.

好的,给你看。 这里需要重点关注的主要内容当然是Claude. md文件,我们稍后会讲到。 但更关键的是顶部的技能(skills)。 所以包括技能。 这些技能是私有技能。 也就是说,出于某些原因,我不想公开发布这些技能,因为它们非常好用,并且对我的业务极其敏感。 这意味着它们在每一次会话中都可以使用。 因此,如果你的组织有一份想要添加的技能清单,那么你应该把它们添加到这里的主仓库中。 这也是一个可以以版本化方式配置设置的地方。

So if you're running a consistent agent in here, You can have settings in your settings. json that spill out over across your entire organization immediately. The main structural things come from the Claude. md here or agents. md. And inside here, you can see that there are navigation pointers to all of the important repos that I on a day-to-day basis touch. So if there are any skill changes, for instance, then it's at repos. ai skills. Anything that needs updating in my course video manager, which is probably my hottest repo in terms of commits, then that goes there. Anything for the Coho 05 project, anything for the AI coding crash course repo. So when I'm talking about these links, then from the home repo to other repos, this is how they're done. Literally just a path inside the agents. md. On a fresh machine, the agent, what it does is if Sandcastle doesn't exist at this location, then it clones it down. And then if there are several agents running at once, it will just use a work tree within that same repo. So it's zero setup, basically.

所以,如果你在这里运行一个稳定的智能体,你可以在你的设置中进行配置。 这些 JSON 会立刻波及你的整个组织。 主要的结构性内容来自 Claude. md 这里或 agents. md。 里面你可以看到指向我日常工作中会接触的所有重要仓库的导航指针。 所以如果有任何技能方面的改动,例如,就放在 repos. ai skills。 我的课程视频管理器里需要更新的任何内容,就放到那里,它大概是我提交最频繁的仓库。 与 Coho 05 项目相关的任何内容,以及与 AI 编程速成课程仓库相关的任何内容。 所以当我提到这些链接,也就是从主仓库指向其他仓库时,就是这样实现的。 实际上就是 agents 里的一个路径。 md。 在全新的机器上,代理会检查 Sandcastle 是否存在于此位置,如果不存在,就把它克隆下来。 如果同时运行多个代理,它们就会在同一个仓库内使用一个 work tree。 所以基本上是零配置。

It just works on its own. And then, you know, eventually you have to do some normal work. tree cleanup as you go. if i wanted to add another repo to the list, then i just edit agents. md and then it just goes into the same setup. this setup works for maybe 20, 30, 40 repos possibly. it wouldn't scale to like 400 repos. but for those situations, i would just add a bit of progressive disclosure. inside your agents. md, instead of linking to the raw repos, you would just say, okay, here are the front end repos, here are the back end repos, and here are the internal repos for internal tooling. And then inside there, you can just link to the repos from there. So this means that the agent would just be able to find the right repo based on just simple file system tactics. And by the way, it's worth saying that I love mono repos. Like if all of this stuff could live in one repo, I would do it. You know, I used to be employed at Vercel as the turbo repo DevRel. You know, I'm very into mono repos, but you can't always do them, especially if you need a mix of like some of these repos need to be public, some of them need to be private. So what I'd say is that if you can move all this stuff into a single repo, then great. If you can't, and most likely you can't just because of political will, then a home repo is the way to go. There's one more thing to say about home repos, which is that.

它自己就能运行。 然后,你知道,最终还是得做一些常规工作。 随着进展进行 tree 清理。 如果我想把另一个仓库加入列表,我只需编辑 agents.md,然后它就会进入同样的设置流程。 md。 这种设置可能只适用于20、30、40个仓库左右。 如果是400个仓库,它就无法扩展了。 但对于这种情况,我会加入一点渐进式披露。 在你的 agents.md 里面。 不是直接链接原始仓库,而是直接说:好,这里是前端仓库,这里是后端仓库,这里是内部工具的内部仓库。 然后在每个部分里面,你可以直接链接到对应的仓库。 这意味着智能体只需依靠简单的文件系统方法,就能找到正确的仓库。 顺便说一下,我很喜欢单体仓库(monorepo)。 如果这些东西都能放在一个仓库里,我会这么做。 你知道,我以前在 Vercel 担任 Turborepo 的开发者关系负责人。 你知道,我非常喜欢单体仓库,但并不总是能采用,尤其是当你需要混合使用时,比如有些仓库必须公开,有些必须私有。 所以我的建议是:如果你能把这些内容都放进一个仓库,那就太好了。 如果做不到,而且很可能做不到,因为政治意愿的问题,那么就用一个 home 仓库吧。 关于 home 仓库,还有一点要说,那就是:

I have noticed that I've been able to be much more ambitious with the tooling I've created for my agents since adopting a home repo. I call my home repo my personal wiki because it is an enormous wiki of all of the data that is kind of sensitive to my business. It lives inside here inside wiki and it's essentially a LLM wiki, Karpathy style, with a bunch of markdown files of interesting stuff that my audience finds cool or finds interesting. I will talk about how I generate this wiki and how I keep it up to date in a future video because people are obsessed with this idea. But I mean, it's just very important to my business because I'm able to query it, able to extract really, really rich data from it that goes into course creation, goes into content creation, etc. And because I've got this home repo, it just makes it the obvious spot to house this wiki. I've also been kind of burying the lead on tooling as well because tooling is absolutely essential, giving your agent like custom tools that it can use to interface with the stuff you use for your business.

自从采用 home 仓库之后,我发现自己为智能体创建的工具可以变得更加有雄心。 我把我的 home 仓库称为个人维基,因为它是一个庞大的维基,包含了所有对我的业务较为敏感的数据。 它就存放在这里的 wiki 目录中,本质上是一个 LLM 维基,采用 Karpathy 的风格,里面有一堆 markdown 文件,记录着我的观众觉得有趣或酷的内容。 关于我如何生成这个维基以及如何保持其更新,我会在以后的视频中讲,因为大家对这个想法非常着迷。 但我的意思是,它对我的业务非常重要,因为我能够查询它,并从中提取非常丰富的数据,用于课程制作、内容创作等。 而且因为我有这个 home 仓库,它自然就成了存放这个维基的最佳位置。 我还一直没把工具这件事说到重点上,因为工具绝对是必不可少的,比如给你的智能体定制一些工具,让它能与你业务中使用的各种东西对接。

If I run wiki help inside my personal wiki directory, we can see that there is a ton of stuff here integrating with Gmail, with Slack, with Discord, with YouTube, with GitHub, GCal, AI Hero. Cold turkey to like do my blocks, things like this. I publish one-off HTML reports, a pen to butter, a butter buffer. This stuff has been able to grow up organically inside the personal wiki and add to this huge great ecosystem that I'm able to build on based on the fact that I've got it all centralized. I always run in one location. This means that I'm able to do crazy things like say, okay, look up this message in Discord, then go to the crash course repo, let's say, make a fix there using all of the existing skills that you've already got. From there, you can use my CVM skill inside my course video manager, wherever it is, just up here, and use this to go and actually edit the course to make the fix.

如果我在个人 wiki 目录里运行 wiki help,就能看到这里有大量集成内容,包括 Gmail、Slack、Discord、YouTube、GitHub、GCal 和 AI Hero。 比如直接硬上,去做我的 blocks,诸如此类。 我会发布一次性的 HTML 报告,一个 pen to butter,一个 butter buffer。 这些东西在个人 wiki 里自然地成长起来,因为我把一切都集中在一处,它们汇聚成一个庞大的生态系统,我可以在此基础上继续构建。 我始终只在一个地方运行。 这意味着我可以做一些疯狂的事情,比如说:好,去 Discord 里查找这条消息,然后去 crash course 仓库,假设在那里做个修复,用你已经拥有的所有现有技能。 接着,你可以在我的课程视频管理器(course video manager)里使用我的 CVM 技能,它就在这里,然后用它去实际编辑课程,完成这个修复。

In other words, the home repo becomes the tooling that links all different parts of your business up together. not only the code, but giving access to the agent to really rich data sources and rich tooling that it can use to actually do better work. so how do you set one up for yourself? well, i have written an article called the home repo pattern. and in this article, i've included a prompt down here that you can use to set one up. it essentially just grills you about your own setup, looks at all of the repos that you need to care about. and then it will start to move things into a home repo. and of course, the link to this is down below. and by the way, if you dig what i'm putting out here, then you would really enjoy my self-paced ai coding crash course. this is the perfect introduction to if you want to learn about agents, if you have never tried using agents before, maybe, or you just feel like you're falling behind in this big, exciting world. but anyway, that is the home repo, the pattern that i thought was. kind of too basic to post, but now i talk about it, i realize, okay, it actually solves a bunch of problems that people are actually having. so enjoy it. enjoy setting it up and enjoy your new home, i guess. nice work, and i'll see you in the next one.

换句话说,home repo 就成了把你业务各个部分串联起来的工具层。 不仅是代码,还让智能体能够访问丰富的数据源和强大的工具,从而真正把工作做得更好。 那么,你该怎样为自己搭建一个呢? 嗯,我写了一篇文章,叫作《home repo 模式》。 在这篇文章里,我在下面附了一段提示词,你可以用它来搭建。 它基本上会详细询问你自己的设置情况,查看你需要关注的所有仓库。 然后开始把相关内容迁移到 home repo 里。 当然,文章链接就在下面。 顺便说一句,如果你喜欢我在这里分享的内容,你一定会喜欢我的自定进度 AI 编程速成课程。 如果你想学习智能体,或者你从未用过智能体,又或者你觉得自己在这个激动人心的新世界里逐渐落后,这门课就是完美的入门选择。 总之,home repo 这个模式,我原本觉得太基础了,不值得发布。 但现在我讲了它,我意识到,它其实解决了很多人正在面临的实际问题。 所以好好享受吧。 享受布置的过程吧,也享受你的新家,我想。 干得不错,我们下期再见。

摘要

视频介绍一种名为 Home Repo(家仓库)的做法,用来解决智能体需要同时跨多个代码仓库工作时的配置与上下文难题。作者先分析多仓库组织的常见情况:技能、工具和 agents.md 等配置在各仓库重复维护,难以同步;放在用户目录又容易脱离团队标准。随后,他提出把私有技能、转向文件、个人 wiki 和自定义工具集中放进一个专门仓库,智能体始终从这里启动,并通过路径链接访问其他仓库。视频还展示了他自己的家仓库结构,说明缺失的仓库会自动克隆、并行任务使用工作树,以及仓库数量增长后如何用渐进式披露组织链接。最后,作者强调家仓库能把业务数据与工具串联起来,并提供了设置文章与提示词。整体上,它对无法使用单体仓库的团队提供了一个低成本、可扩展的实用方案。

章节

00:00 多仓库智能体的问题

作者说明这一做法起初被他认为过于简单而不值得分享,但在课程答疑中展示后反响很好,发布到 Twitter 后也引起广泛关注。它要解决的问题是:如何同时在多个代码仓库中使用智能体。以一个典型组织为例,其中有店面、支付 API、管理后台以及二十多个偶尔需要修改的仓库。只改动单个仓库时,直接在对应目录运行智能体即可;若需要跨仓库修改,智能体可以在多个目录中同时工作,从同一会话产生多个拉取请求。真正的麻烦在于配置数据:技能、工具、agents.md 乃至 wiki 链接通常在各仓库中重复存放,使每次会话都能访问这些内容,但也意味着要在三四十个仓库之间保持同步。

开场提出的技术概念
办公时段现场演示该技术
观众对技术简单性的反应
帖子传播后的反响
强调该技术值得分享

01:13 家目录方案的缺陷

作者考虑过把技能和工具放进每个人的本地用户目录,使其能在所有仓库中生效,但这种做法同样有问题。用户目录对用户不可见,因此内容不会随团队标准更新,容易逐渐落后于全局配置。另外,作者认为用户目录是个人调整自身设置的地方,其中的内容更符合个人习惯,而不是团队希望的工作方式。因此,无论是在各仓库重复维护,还是放在用户目录,都难以令人满意,多仓库工作者缺少良好选择。

家目录方案中技能、工具和 agents.md 在多个仓库重复存放的核心问题

02:15 Home Repo 的概念与结构

作者提出的解决方案称为 Home Repo:使用一个单独的仓库,集中存放所有技能、转向文件、wiki 和大量自定义工具。由于智能体总是在这个仓库内启动,它既能像普通仓库一样运行,也能访问店面、支付 API 等其他仓库,跨仓库调用上下文。视频随后展示了他的家仓库,重点包括 CLAUDE.md、顶部的私有技能目录,以及 settings.json。这些私有技能对业务十分敏感,因此不会公开发布,但会在每个会话中可用。组织若要添加共享技能,也应放入家仓库,设置则能以版本化方式即时在整个组织中生效。

多仓库结构的代表性画面
提出的 home repo 解决方案
单一 home 仓库的概念
在 home 仓库中运行智能体
智能体跨仓库访问的内容

02:57 私有技能、设置与导航指引

家仓库的主要结构来自 CLAUDE.md 或 agents.md,其中包含导航指引,指向作者日常经常修改的重要仓库。例如,技能变更指向 repos.ai-skills,课程视频管理器对应他提交最频繁的仓库,另外还有 Coho 05 项目和 AI 编程速成课仓库。这些链接的写法很直接:在 agents.md 中写入仓库路径即可。设置方面,作者说明家仓库也是以版本化方式配置设置的地方,使持续运行的智能体在整个组织中保持一致。

界面中的 CLAUDE.md 文件
页面顶部的 skills 区域
首页仓库位置,用于添加组织技能

03:33 仓库链接与自动克隆机制

智能体在全新机器上使用路径链接时,如果指定位置没有对应仓库,就会自动克隆。若多个智能体同时运行,它会在同一仓库内使用工作树(worktree)隔离工作,因此基本无需额外配置,开箱即用。之后仍需要进行正常的工作树清理。若要新增仓库,只需编辑 agents.md 添加路径,即可进入同样的流程。

仓库内导航指针列表,展示指向常用仓库的链接
技能仓库的路径链接,对应技能变更的位置
agents.md 中的仓库路径链接示例
新机器上仓库不存在时自动克隆的位置判断

04:31 规模扩展与为何仍偏爱单体仓库

作者认为,这套方法大约适用于 20 到 40 个仓库,但不适合约 400 个仓库的规模。在更大规模下,可以在 agents.md 中使用渐进式披露:按前端、后端、内部工具等类别列出目录,再从这些目录链接到具体仓库。这样智能体可以通过简单的文件系统路径找到正确仓库。作者仍然喜欢单体仓库,并指出他曾任 Vercel 的 Turborepo 开发者关系负责人。但由于部分仓库需要公开、部分需要私有,且政治和组织因素常常限制合并,他认为如果不能合并,家仓库就是可行的替代方案。

演示编辑 agents.md 文件,向仓库列表添加新仓库
agents.md 中按前端、后端、内部工具分组的渐进式披露结构

05:46 个人 Wiki 与智能体的数据价值

作者把家仓库称为个人 wiki,因为其中包含大量对业务敏感的数据。这个 wiki 采用 Karpathy 风格的 LLM wiki 结构,由许多 Markdown 文件组成,记录观众感兴趣的内容。作者可以查询这些资料,并提取用于课程制作和内容创作的丰富数据。由于所有内容集中在家仓库中,wiki 自然地放在这里。作者还表示,之后会单独介绍如何生成和保持这个 wiki 更新。

个人 Wiki 仓库中的 markdown 文件列表

06:46 自定义工具生态

作者认为,为智能体提供与业务相关的自定义工具同样关键。在个人 wiki 目录中运行 wiki help,可以看到大量已集成的工具,覆盖 Gmail、Slack、Discord、YouTube、GitHub、Google Calendar 和 AI Hero 等服务,还包括番茄钟式的任务块管理。作者还会发布一次性的 HTML 报告,并有其他工具在个人 wiki 中自然成长,形成一个可扩展的生态。由于一切都集中在一处,智能体始终在同一位置运行,因此能完成跨工具协作,例如从 Discord 查找消息,在课程仓库中修复问题,再使用课程视频管理器工具编辑课程。

在个人wiki目录中运行wiki help后可见的大量集成工具列表
屏幕上方指示CVM技能所在位置

07:42 设置方法与收尾

作者说明,Home Repo 的做法可以带来更丰富的数据来源和工具,使智能体实际完成更好的工作,而不只是处理代码。若要搭建自己的家仓库,可以参考他撰写的 The Home Repo Pattern 文章,其中有一段提示词,会询问用户现有配置,梳理需要关注的仓库,然后逐步把相关内容迁移到家仓库中。作者还推荐了自己的自定进度 AI 编程速成课程,认为它适合从未使用过智能体或担心落后的人。他最后表示,这个曾经觉得太基础而不想发布的模式,在收到大量反馈后证明确实解决了许多实际问题。

家庭代码仓库概念引入
丰富数据源与工具说明
设置方法引入
文章与模式名称
设置用提示词

结论

01:13 在多个代码仓库中维护重复的技能、工具和智能体配置难以同步,放在用户目录又容易脱离团队标准。

02:24 Home Repo 通过把私有技能、转向文件、wiki 和工具集中在单一仓库,并让智能体始终从该仓库启动,实现跨仓库的统一上下文。

04:16 借助路径链接与自动克隆,智能体在新机器上几乎无需额外配置即可访问所有相关仓库,并通过工作树隔离并行任务。

04:42 这种做法适用于约二三十个仓库的规模;更大规模时可用渐进式披露组织目录结构,单体仓库仍是理想选择,但在无法合并时家仓库是可行替代。