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 这个模式,我原本觉得太基础了,不值得发布。 但现在我讲了它,我意识到,它其实解决了很多人正在面临的实际问题。 所以好好享受吧。 享受布置的过程吧,也享受你的新家,我想。 干得不错,我们下期再见。