Skip to content

Commit 2342d95

Browse files
committed
update ecfr config
1 parent 9f2050a commit 2342d95

File tree

2 files changed

+114
-69
lines changed

2 files changed

+114
-69
lines changed

client/agents/compliai/config.js

+112-69
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ Extract and read the full content from a webpage, PDF, DOCX, or any multimedia o
6161
"toolSpec": {
6262
"name": "ecfr",
6363
"description": `
64-
Access the Electronic Code of Federal Regulations (eCFR) API to retrieve regulatory information. This tool provides a direct interface to the official eCFR API endpoints.
65-
64+
Access the Electronic Code of Federal Regulations (eCFR) API to retrieve regulatory information. The eCFR contains the official codified text of federal regulations currently in effect.
65+
6666
WHEN TO USE THIS TOOL:
6767
- Use this tool FIRST for ANY questions about current federal regulatory requirements or definitions
6868
- Reach for this tool IMMEDIATELY when users ask "what is the law/regulation on X?"
@@ -74,39 +74,71 @@ Extract and read the full content from a webpage, PDF, DOCX, or any multimedia o
7474
- Check this tool when analyzing regulatory compliance questions
7575
- Turn to this tool for finding legal definitions within regulations
7676
- Combine with the Federal Register tool to get both current regulations and regulatory history
77-
78-
MULTI-STEP RESEARCH APPROACH:
79-
For complex regulatory questions, use a structured research process:
80-
1. Begin by identifying the relevant CFR title based on the subject matter (e.g., Title 40 for environmental regulations)
81-
2. Use the structure endpoint to understand the organization of a title and its parts
82-
3. Navigate from higher levels (title) to more specific levels (part, section) as needed
83-
4. For citation-based queries, use the ancestry endpoint to locate the specific provision
84-
5. Retrieve the full XML of relevant parts to analyze complete regulatory context
85-
6. Compare the same regulation across different dates to understand changes over time
86-
7. Use the titles endpoint to check recency and ensure you're working with up-to-date regulations
87-
8. For historical research, use specific dates to retrieve past versions of regulatory text
88-
9. When analyzing related provisions, examine the broader part or subpart, not just individual sections
89-
10. Cross-reference eCFR findings with Federal Register documents to understand regulatory intent and history
90-
77+
78+
MULTI-STEP RESEARCH APPROACH - CRITICAL:
79+
1. ALWAYS START WITH THE SEARCH ENDPOINTS to identify relevant content and avoid hallucinations
80+
- Begin with "/search/v1/results" to find matching sections and get their exact IDs
81+
- Use "/search/v1/counts/titles" to identify which titles contain relevant content
82+
- Only after identifying specific content through search should you access versioner endpoints
83+
84+
2. For exploring regulatory structure:
85+
- First use "/admin/v1/agencies.json" to identify relevant agencies and their CFR references
86+
- Then use "/versioner/v1/titles.json" to get title information and current dates
87+
- Only then navigate to specific title structures or content
88+
89+
3. For specific regulatory text:
90+
- First confirm the title, part, and section exist via search
91+
- Then use ancestry or structure endpoints to validate the hierarchy
92+
- Finally retrieve full content with the correct identifiers
93+
94+
4. For date-based research:
95+
- Always check "/versioner/v1/titles.json" to get valid date ranges
96+
- Never use future dates or invalid dates in requests
97+
- Use actual dates from the titles endpoint to ensure data exists for that point in time
98+
99+
5. Additional steps for thorough research:
100+
- Compare the same regulation across different dates to understand changes over time
101+
- When analyzing related provisions, examine the broader part or subpart, not just individual sections
102+
- Cross-reference eCFR findings with Federal Register documents for regulatory intent and history
103+
91104
EXACT PATH USAGE EXAMPLES:
92-
- List all agencies:
105+
106+
Admin Service:
107+
- Get all agencies:
93108
ecfr({path: "/admin/v1/agencies.json"})
94109
95-
- List all corrections:
110+
- Get all corrections:
96111
ecfr({path: "/admin/v1/corrections.json"})
97112
98-
- List corrections for Title 7:
113+
- Get corrections for Title 7:
99114
ecfr({path: "/admin/v1/corrections/title/7.json"})
100115
116+
Search Service:
101117
- Search for regulations containing "emissions standards":
102118
ecfr({path: "/search/v1/results", params: {query: "emissions standards"}})
103119
104-
- Get detailed search results with pagination:
105-
ecfr({path: "/search/v1/results", params: {query: "privacy", per_page: 20, page: 1}})
106-
107-
- Get search count for "privacy" regulations:
120+
- Get the count of search results:
108121
ecfr({path: "/search/v1/count", params: {query: "privacy"}})
109122
123+
- Get search summary details:
124+
ecfr({path: "/search/v1/summary", params: {query: "privacy"}})
125+
126+
- Get search counts by date:
127+
ecfr({path: "/search/v1/counts/daily", params: {query: "emissions"}})
128+
129+
- Get search counts by title:
130+
ecfr({path: "/search/v1/counts/titles", params: {query: "emissions"}})
131+
132+
- Get search counts by hierarchy:
133+
ecfr({path: "/search/v1/counts/hierarchy", params: {query: "emissions"}})
134+
135+
- Get search suggestions:
136+
ecfr({path: "/search/v1/suggestions", params: {query: "emissions"}})
137+
138+
Versioner Service:
139+
- Get information about all titles (use this to find valid dates):
140+
ecfr({path: "/versioner/v1/titles.json"})
141+
110142
- Get ancestry for Title 40 as of January 1, 2023:
111143
ecfr({path: "/versioner/v1/ancestry/2023-01-01/title-40.json"})
112144
@@ -116,13 +148,10 @@ Extract and read the full content from a webpage, PDF, DOCX, or any multimedia o
116148
- Get full XML content for Title 40 as of January 1, 2023:
117149
ecfr({path: "/versioner/v1/full/2023-01-01/title-40.xml"})
118150
119-
- Get information about all titles:
120-
ecfr({path: "/versioner/v1/titles.json"})
121-
122151
- Get versions of Title 40:
123152
ecfr({path: "/versioner/v1/versions/title-40.json", params: {"issue_date[gte]": "2022-01-01"}})
124153
125-
AVAILABLE ENDPOINTS:
154+
AVAILABLE ENDPOINTS (DIRECTLY FROM API DOCUMENTATION):
126155
127156
Admin Service Endpoints:
128157
- /admin/v1/agencies.json - List all top-level agencies in name order
@@ -151,7 +180,7 @@ Extract and read the full content from a webpage, PDF, DOCX, or any multimedia o
151180
"properties": {
152181
"path": {
153182
"type": "string",
154-
"description": "The complete eCFR API path including format extension (.json or .xml)"
183+
"description": "The API path including format extension (.json or .xml)"
155184
},
156185
"params": {
157186
"type": "object",
@@ -167,11 +196,11 @@ Extract and read the full content from a webpage, PDF, DOCX, or any multimedia o
167196
},
168197
"date": {
169198
"type": "string",
170-
"description": "Date in YYYY-MM-DD format (for corrections endpoints)"
199+
"description": "Date in YYYY-MM-DD format (for various endpoints)"
171200
},
172201
"title": {
173202
"type": "string",
174-
"description": "Title number (for corrections by title)"
203+
"description": "Title number (e.g., '1', '2', '50')"
175204
},
176205
"error_corrected_date": {
177206
"type": "string",
@@ -193,6 +222,22 @@ Extract and read the full content from a webpage, PDF, DOCX, or any multimedia o
193222
"type": "string",
194223
"description": "How results should be paginated ('date' or 'results')"
195224
},
225+
"last_modified_after": {
226+
"type": "string",
227+
"description": "Content modified after date (YYYY-MM-DD)"
228+
},
229+
"last_modified_on_or_after": {
230+
"type": "string",
231+
"description": "Content modified on or after date (YYYY-MM-DD)"
232+
},
233+
"last_modified_before": {
234+
"type": "string",
235+
"description": "Content modified before date (YYYY-MM-DD)"
236+
},
237+
"last_modified_on_or_before": {
238+
"type": "string",
239+
"description": "Content modified on or before date (YYYY-MM-DD)"
240+
},
196241
"subtitle": {
197242
"type": "string",
198243
"description": "Subtitle identifier (e.g., 'A', 'B', 'C')"
@@ -232,22 +277,6 @@ Extract and read the full content from a webpage, PDF, DOCX, or any multimedia o
232277
"issue_date[gte]": {
233278
"type": "string",
234279
"description": "Content added on or after issue date (YYYY-MM-DD)"
235-
},
236-
"last_modified_after": {
237-
"type": "string",
238-
"description": "Content modified after date (YYYY-MM-DD)"
239-
},
240-
"last_modified_on_or_after": {
241-
"type": "string",
242-
"description": "Content modified on or after date (YYYY-MM-DD)"
243-
},
244-
"last_modified_before": {
245-
"type": "string",
246-
"description": "Content modified before date (YYYY-MM-DD)"
247-
},
248-
"last_modified_on_or_before": {
249-
"type": "string",
250-
"description": "Content modified on or before date (YYYY-MM-DD)"
251280
}
252281
}
253282
}
@@ -262,30 +291,44 @@ Extract and read the full content from a webpage, PDF, DOCX, or any multimedia o
262291
"name": "federalRegister",
263292
"description": `
264293
Access the Federal Register API to retrieve regulatory documents and information. The Federal Register is the official journal of the U.S. government that contains federal agency regulations, proposed rules, public notices, executive orders and other presidential documents.
265-
294+
266295
WHEN TO USE THIS TOOL:
267-
- Use this tool FIRST for ANY questions about federal regulations, rules, notices, or executive orders
268-
- Use whenever a user asks about recent government actions, policy changes, or regulatory updates
269-
- Reach for this tool LIBERALLY to find authoritative information from government sources
270-
- Use to AUGMENT search results with official regulatory information
271-
- Use when asked about specific agencies' recent actions or publications
272-
- Use to find detailed information about executive orders, including their full text
273-
- Check this tool PROACTIVELY when answering questions about regulated industries or activities
274-
- Use when seeking information about the regulatory process or timeline for a particular rule
275-
- Combine with the eCFR tool for comprehensive regulatory research
276-
277-
MULTI-STEP RESEARCH APPROACH:
278-
For complex regulatory questions, use a structured research process:
279-
1. Begin with a broad search to identify relevant documents and agencies
280-
2. Use the facets endpoint to understand the distribution of documents by agency, type, or date
281-
3. Narrow your search with more specific parameters based on initial findings
282-
4. Retrieve full documents for the most relevant results
283-
5. For regulatory history, search for related documents using RIN numbers or docket IDs
284-
6. When analyzing a regulatory area, check both final rules and proposed rules
285-
7. For comprehensive analysis, combine Federal Register searches with eCFR lookups
286-
8. Use public inspection documents to get early access to soon-to-be-published regulations
287-
9. Check both current and historical documents to trace regulatory evolution
288-
10. Always verify findings with the most authoritative and recent sources
296+
- Use this tool FIRST for ANY questions about current federal regulatory requirements or definitions
297+
- Reach for this tool IMMEDIATELY when users ask "what is the law/regulation on X?"
298+
- Use PROACTIVELY to find specific regulatory language, definitions, and requirements
299+
- Reference this tool to verify regulatory citations (e.g., "40 CFR 60.4")
300+
- Use when a user needs the EXACT TEXT of a current regulation
301+
- Consult this resource for technical regulatory standards and specifications
302+
- Use to determine jurisdictional boundaries in regulatory matters
303+
- Check this tool when analyzing regulatory compliance questions
304+
- Turn to this tool for finding legal definitions within regulations
305+
- Combine with the Federal Register tool to get both current regulations and regulatory history
306+
307+
MULTI-STEP RESEARCH APPROACH:
308+
1. ALWAYS START WITH THE SEARCH ENDPOINTS to identify relevant content and avoid hallucinations
309+
- Begin with "/search/v1/results" to find matching sections and get their exact IDs
310+
- Use "/search/v1/counts/titles" to identify which titles contain relevant content
311+
- Only after identifying specific content through search should you access versioner endpoints
312+
313+
2. For exploring regulatory structure:
314+
- First use "/admin/v1/agencies.json" to identify relevant agencies and their CFR references
315+
- Then use "/versioner/v1/titles.json" to get title information and current dates
316+
- Only then navigate to specific title structures or content
317+
318+
3. For specific regulatory text:
319+
- First confirm the title, part, and section exist via search
320+
- Then use ancestry or structure endpoints to validate the hierarchy
321+
- Finally retrieve full content with the correct identifiers
322+
323+
4. For date-based research:
324+
- Always check "/versioner/v1/titles.json" to get valid date ranges
325+
- Never use future dates or invalid dates in requests
326+
- Use actual dates from the titles endpoint to ensure data exists for that point in time
327+
328+
5. Additional steps for thorough research:
329+
- Compare the same regulation across different dates to understand changes over time
330+
- When analyzing related provisions, examine the broader part or subpart, not just individual sections
331+
- Cross-reference eCFR findings with Federal Register documents for regulatory intent and history
289332
290333
EXACT PATH USAGE EXAMPLES:
291334

client/agents/compliai/utils.js

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import TurndownService from "turndown";
66
import * as pdfjsLib from "pdfjs-dist";
77
pdfjsLib.GlobalWorkerOptions.workerSrc = "https://cdn.jsdelivr.net/npm/[email protected]/build/pdf.worker.min.mjs";
88

9+
window.TOOLS = { search, browse, code, ecfr, federalRegister };
10+
911
/**
1012
* Runs JSON tools with the given input and returns the results. Each tool is a function that takes a JSON input and returns a JSON output.
1113
* @param {any} toolUse - The tool use object

0 commit comments

Comments
 (0)