agent-context 0.2.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/bake/agent/context.rb +7 -7
- data/lib/agent/context/index.rb +16 -16
- data/lib/agent/context/installer.rb +1 -1
- data/lib/agent/context/version.rb +1 -1
- data/post.md +8 -8
- data/readme.md +13 -68
- data/releases.md +4 -0
- data.tar.gz.sig +0 -0
- metadata +1 -1
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 11e3e6b44ae4b564cf5a70031206df479edcc02e716c0c6eadc74e36f8118bd8
|
4
|
+
data.tar.gz: fe26f5e667e56ab362581df7b8e591d570a7f666638b12d31baa41daef4667f7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 49995cbd0a102933c17760bf7d11b39d788e1bc91a1b0da6db3ff5cc70b6d047f5d806bf822a3a4e12073ba3cc244b60204ea84466b41d4155ffdb2da940fc83
|
7
|
+
data.tar.gz: fdad0c51486de3e66bdd3a7e2eeb9dfd0485dbcaec56256f95e9942489d38270ad9d972640de11f6be3d3de21cdbf2e195e608381153281e0ef31bfe0f6cbd1e
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/bake/agent/context.rb
CHANGED
@@ -75,14 +75,14 @@ def install(gem: nil)
|
|
75
75
|
end
|
76
76
|
end
|
77
77
|
|
78
|
-
# Update
|
78
|
+
# Update agents.md after installing context
|
79
79
|
index = Agent::Context::Index.new(@installer.context_path)
|
80
|
-
index.
|
80
|
+
index.update_agents_md
|
81
81
|
end
|
82
82
|
|
83
|
-
# Update or create
|
84
|
-
# This follows the
|
85
|
-
def
|
86
|
-
index = Agent::Context::Index.new(@
|
87
|
-
index.
|
83
|
+
# Update or create AGENTS.md in the project root with context section
|
84
|
+
# This follows the AGENTS.md specification for agentic coding tools
|
85
|
+
def agents_md(path = "agents.md")
|
86
|
+
index = Agent::Context::Index.new(@installer.context_path)
|
87
|
+
index.update_agents_md(path)
|
88
88
|
end
|
data/lib/agent/context/index.rb
CHANGED
@@ -12,11 +12,11 @@ require "yaml"
|
|
12
12
|
module Agent
|
13
13
|
# @namespace
|
14
14
|
module Context
|
15
|
-
# Represents an index for managing and generating
|
15
|
+
# Represents an index for managing and generating agents.md files from context files.
|
16
16
|
#
|
17
|
-
# This class provides functionality to update or create
|
18
|
-
# the
|
19
|
-
#
|
17
|
+
# This class provides functionality to update or create AGENTS.md files following
|
18
|
+
# the AGENTS.md specification for agentic coding tools. It can parse existing
|
19
|
+
# agents.md files, update the context section, and generate new files when needed.
|
20
20
|
class Index
|
21
21
|
# Initialize a new index instance.
|
22
22
|
# @parameter context_path [String] The path to the context directory (default: ".context").
|
@@ -26,18 +26,18 @@ module Agent
|
|
26
26
|
|
27
27
|
attr :context_path
|
28
28
|
|
29
|
-
# Update or create an
|
30
|
-
# This follows the
|
31
|
-
def
|
29
|
+
# Update or create an AGENTS.md file in the project root with context section
|
30
|
+
# This follows the AGENTS.md specification for agentic coding tools
|
31
|
+
def update_agents_md(agents_md_path = "agents.md")
|
32
32
|
context_content = generate_context_section
|
33
33
|
|
34
|
-
if File.exist?(
|
35
|
-
|
34
|
+
if File.exist?(agents_md_path)
|
35
|
+
update_existing_agents_md(agents_md_path, context_content)
|
36
36
|
else
|
37
|
-
|
37
|
+
create_new_agents_md(agents_md_path, context_content)
|
38
38
|
end
|
39
39
|
|
40
|
-
Console.debug("Updated
|
40
|
+
Console.debug("Updated agents.md: #{agents_md_path}")
|
41
41
|
end
|
42
42
|
|
43
43
|
# Generate just the context section content (without top-level headers)
|
@@ -100,8 +100,8 @@ module Agent
|
|
100
100
|
|
101
101
|
private
|
102
102
|
|
103
|
-
def
|
104
|
-
content = File.read(
|
103
|
+
def update_existing_agents_md(agents_md_path, context_content)
|
104
|
+
content = File.read(agents_md_path)
|
105
105
|
|
106
106
|
# Find the # Agent heading
|
107
107
|
agent_heading_line = find_agent_heading_line(content)
|
@@ -123,10 +123,10 @@ module Agent
|
|
123
123
|
end
|
124
124
|
|
125
125
|
# Write the updated content back to file
|
126
|
-
File.write(
|
126
|
+
File.write(agents_md_path, updated_content)
|
127
127
|
end
|
128
128
|
|
129
|
-
def
|
129
|
+
def create_new_agents_md(agents_md_path, context_content)
|
130
130
|
content = [
|
131
131
|
"# Agent",
|
132
132
|
"",
|
@@ -134,7 +134,7 @@ module Agent
|
|
134
134
|
"",
|
135
135
|
context_content,
|
136
136
|
].join("\n")
|
137
|
-
File.write(
|
137
|
+
File.write(agents_md_path, content)
|
138
138
|
end
|
139
139
|
|
140
140
|
def find_agent_heading_line(content)
|
@@ -182,7 +182,7 @@ module Agent
|
|
182
182
|
unless File.exist?(index_path)
|
183
183
|
# Generate dynamic index from gemspec
|
184
184
|
index = generate_dynamic_index(gem, gem_directory)
|
185
|
-
|
185
|
+
|
186
186
|
# Write the generated index
|
187
187
|
File.write(index_path, index.to_yaml)
|
188
188
|
Console.debug("Generated dynamic index for #{gem[:name]}: #{index_path}")
|
data/post.md
CHANGED
@@ -28,11 +28,11 @@
|
|
28
28
|
|
29
29
|
**Claude:** "So how does this work in practice?"
|
30
30
|
|
31
|
-
**Ruby:** "Let me show you! When a developer runs `bake agent:context:install`, it scans all my installed gems for `context/` directories, copies the files to a `.context/` folder in their project, and generates an `
|
31
|
+
**Ruby:** "Let me show you! When a developer runs `bake agent:context:install`, it scans all my installed gems for `context/` directories, copies the files to a `.context/` folder in their project, and generates an `agents.md` file that gives you a comprehensive overview."
|
32
32
|
|
33
|
-
**Claude:** "That sounds perfect! What does this `
|
33
|
+
**Claude:** "That sounds perfect! What does this `agents.md` file look like?"
|
34
34
|
|
35
|
-
**Ruby:** "It's structured and organized, following the
|
35
|
+
**Ruby:** "It's structured and organized, following the AGENTS.md specification. Here's what it generates:"
|
36
36
|
|
37
37
|
```markdown
|
38
38
|
# Agent
|
@@ -87,26 +87,26 @@ my-awesome-gem/
|
|
87
87
|
|
88
88
|
**Claude:** "This is great, but how do I actually access this information? Different AI tools expect different file names and locations."
|
89
89
|
|
90
|
-
**Ruby:** "Good question! The generated `
|
90
|
+
**Ruby:** "Good question! The generated `agents.md` can be linked to whatever your tool expects:"
|
91
91
|
|
92
92
|
**For Cursor:**
|
93
|
-
Create `.cursor/rules/
|
93
|
+
Create `.cursor/rules/agents.mdc` with:
|
94
94
|
|
95
95
|
``` markdown
|
96
96
|
---
|
97
97
|
alwaysApply: true
|
98
98
|
---
|
99
|
-
Read the `
|
99
|
+
Read the `agents.md` file in the project root directory for detailed context relating to this project and external dependencies.
|
100
100
|
```
|
101
101
|
|
102
102
|
**For GitHub Copilot:**
|
103
103
|
```bash
|
104
|
-
ln -s ../../
|
104
|
+
ln -s ../../agents.md .github/copilot-instructions.md
|
105
105
|
```
|
106
106
|
|
107
107
|
**For Claude Code:**
|
108
108
|
```bash
|
109
|
-
ln -s
|
109
|
+
ln -s agents.md CLAUDE.md
|
110
110
|
```
|
111
111
|
|
112
112
|
**Claude:** "Perfect! So developers can easily integrate this with their preferred AI tools."
|
data/readme.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Agent::Context
|
2
2
|
|
3
|
-
Provides tools for installing and managing context files from Ruby gems for AI agents, and generating `
|
3
|
+
Provides tools for installing and managing context files from Ruby gems for AI agents, and generating `agents.md` files following the <https://agents.md> specification.
|
4
4
|
|
5
5
|
[](https://github.com/ioquatix/agent-context/actions?workflow=Test)
|
6
6
|
|
@@ -8,7 +8,7 @@ Provides tools for installing and managing context files from Ruby gems for AI a
|
|
8
8
|
|
9
9
|
This gem allows you to install and manage context files from other gems. Gems can provide context files in a `context/` directory in their root, which can contain documentation, configuration examples, migration guides, and other contextual information for AI agents.
|
10
10
|
|
11
|
-
When you install context from gems, they are placed in the `.context/` directory and an `
|
11
|
+
When you install context from gems, they are placed in the `.context/` directory and an `agents.md` file is generated or updated to provide a comprehensive overview for AI agents.
|
12
12
|
|
13
13
|
## Quick Start
|
14
14
|
|
@@ -23,8 +23,8 @@ This workflow:
|
|
23
23
|
|
24
24
|
- Adds the `agent-context` gem to your project.
|
25
25
|
- Installs context files from all gems into `.context/`.
|
26
|
-
- Generates or updates `
|
27
|
-
- Follows the <https://
|
26
|
+
- Generates or updates `agents.md` with a comprehensive overview.
|
27
|
+
- Follows the <https://agents.md> specification for agentic coding tools.
|
28
28
|
|
29
29
|
## Context
|
30
30
|
|
@@ -32,7 +32,7 @@ This gem provides its own context files in the `context/` directory, including:
|
|
32
32
|
|
33
33
|
- `usage.md` - Comprehensive guide for using and providing context files.
|
34
34
|
|
35
|
-
When you install context from other gems, they will be placed in the `.context/` directory and referenced in `
|
35
|
+
When you install context from other gems, they will be placed in the `.context/` directory and referenced in `agents.md`.
|
36
36
|
|
37
37
|
## Usage
|
38
38
|
|
@@ -52,7 +52,7 @@ $ bundle add agent-context
|
|
52
52
|
|
53
53
|
#### Install Context (Primary Command)
|
54
54
|
|
55
|
-
Install context from all available gems and update `
|
55
|
+
Install context from all available gems and update `agents.md`:
|
56
56
|
|
57
57
|
``` bash
|
58
58
|
$ bake agent:context:install
|
@@ -88,10 +88,10 @@ $ bake agent:context:show --gem async --file thread-safety
|
|
88
88
|
|
89
89
|
## Version Control
|
90
90
|
|
91
|
-
Both `.context/` and `
|
91
|
+
Both `.context/` and `agents.md` should be committed to git:
|
92
92
|
|
93
|
-
- `
|
94
|
-
- `.context/` files are referenced by `
|
93
|
+
- `agents.md` is user-facing documentation that should be versioned.
|
94
|
+
- `.context/` files are referenced by `agents.md` and needed for AI agents to function properly.
|
95
95
|
- This ensures AI agents in CI have access to the full context.
|
96
96
|
|
97
97
|
## Providing Context in Your Gem
|
@@ -125,69 +125,14 @@ files:
|
|
125
125
|
|
126
126
|
If no `index.yaml` is provided, one will be generated automatically from your gemspec and markdown files.
|
127
127
|
|
128
|
-
## AI Tool Integration
|
129
|
-
|
130
|
-
The generated `agent.md` file can be integrated with various AI coding tools by creating symbolic links to their expected locations:
|
131
|
-
|
132
|
-
### Cline
|
133
|
-
|
134
|
-
``` bash
|
135
|
-
ln -s agent.md .clinerules
|
136
|
-
```
|
137
|
-
|
138
|
-
### Claude Code
|
139
|
-
|
140
|
-
``` bash
|
141
|
-
ln -s agent.md CLAUDE.md
|
142
|
-
```
|
143
|
-
|
144
|
-
### Cursor
|
145
|
-
|
146
|
-
First, create the `.cursor/rules` directory:
|
147
|
-
|
148
|
-
``` bash
|
149
|
-
mkdir -p .cursor/rules
|
150
|
-
```
|
151
|
-
|
152
|
-
Then create `.cursor/rules/agent.mdc` with:
|
153
|
-
|
154
|
-
``` markdown
|
155
|
-
---
|
156
|
-
alwaysApply: true
|
157
|
-
---
|
158
|
-
Read the `agent.md` file in the project root directory for detailed context relating to this project and external dependencies.
|
159
|
-
```
|
160
|
-
|
161
|
-
This approach uses Cursor's proper front-matter format and directs the AI to consult the main `agent.md` file.
|
162
|
-
|
163
|
-
### Gemini CLI, OpenAI Codex, OpenCode
|
164
|
-
|
165
|
-
``` bash
|
166
|
-
ln -s agent.md AGENTS.md
|
167
|
-
```
|
168
|
-
|
169
|
-
### GitHub Copilot
|
170
|
-
|
171
|
-
``` bash
|
172
|
-
ln -s ../../agent.md .github/copilot-instructions.md
|
173
|
-
```
|
174
|
-
|
175
|
-
### Replit
|
176
|
-
|
177
|
-
``` bash
|
178
|
-
ln -s agent.md .replit.md
|
179
|
-
```
|
180
|
-
|
181
|
-
### Windsurf
|
182
|
-
|
183
|
-
``` bash
|
184
|
-
ln -s agent.md .windsurfrules
|
185
|
-
```
|
186
|
-
|
187
128
|
## Releases
|
188
129
|
|
189
130
|
Please see the [project releases](https://ioquatix.github.io/agent-context/releases/index) for all releases.
|
190
131
|
|
132
|
+
### v0.3.0
|
133
|
+
|
134
|
+
- Rename `agent.md` -\> `agents.md`.
|
135
|
+
|
191
136
|
### v0.2.0
|
192
137
|
|
193
138
|
- Don't limit description length.
|
data/releases.md
CHANGED
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
metadata.gz.sig
CHANGED
Binary file
|