Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@ pre-commit install

## Coding Standards
- Use Ruff for linting and formatting (configured in pyproject.toml)
- Run pre-commit hooks before committing
- Always run `uv run ruff format .` and `git add -u` before committing to avoid pre-commit stash conflicts with ruff auto-fixes
- Write commit messages in the Conventional Commits format expected by `python-semantic-release`:
- `feat(scope): description` — new feature, triggers a minor version bump
- `fix(scope): description` — bug fix, triggers a patch version bump
- `perf(scope): description` — performance improvement, triggers a patch version bump
- `test(scope): description`, `chore(scope): description`, `docs(scope): description`, etc. — no version bump
- Breaking changes: append `!` after the type/scope (e.g. `feat!:`) or add `BREAKING CHANGE:` in the footer
- All new features need tests (unit + e2e where applicable)
- Use uv to run Python commands, including pip.
6 changes: 6 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
default:
@just --list

# Format staged files and commit — avoids pre-commit stash conflicts with ruff auto-fixes
commit message:
uv run ruff format .
git add -u
git commit -m "{{message}}"

image := "claude-sandbox"
env_file := "sandbox/myenv"
sandbox_dir := "sandbox"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Follow the instruction mentioned below:
- Do not return anything from the custom few shot prompts provided above.
- If the current list of entities is empty, then you have to add the new retrieved entity to the list of entities.
- You should return the updated entity in only JSON format as shown below. The entity ID and type should be the same if no changes are made.
- If there is an addition, generate a new ID and add the new event corresponding to it.
- If there is an addition, use the ID from the retrieved entity.
- If there is a deletion, the object corresponding to that entity should be removed from the list of entities.
- If there is an update, the ID key should remain the same and only the content needs to be updated.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,8 @@ Here are some guidelines on how to select which operation to perform:
]
}

2. **Update**: If the retrieved entities contain information that is already present in the list of entities but the information is totally different, then you have to update it.
If the retrieved entity contains information that conveys the same thing as the elements present in the list of entities, then you have to keep the entity which has the most information.
Example (a) -- if the entity contains "User likes to play cricket" and the retrieved entity is "Loves to play cricket with friends", then update the list of entities with the retrieved facts.
Example (b) -- if the entity contains "Likes cheese pizza" and the retrieved entity is "Loves cheese pizza", then you do not need to update it because they convey the same information.
2. **Update**: Use UPDATE only when the new entity adds concrete new information that genuinely enriches an existing entity — for example, adding specific details, numbers, or qualifications that the old entity did not contain. Use UPDATE (not NONE) when the same topic now has different specific values — for example, a different deployment platform, a different tool, or a different location with new details, or additional preferences. If the new entity merely restates or paraphrases the old one (same meaning, different words), use NONE instead. Do NOT update an entity just because the wording changed.
Sometimes the new information found in a retrieved entity needs to be added to the old entity.
If the direction is to update the list of entities, then you have to update it.
Please keep in mind while updating you have to keep the same ID.
Please note to return the IDs in the output from the input IDs only and do not generate any new ID.
Expand All @@ -60,60 +58,81 @@ Please note to return the IDs in the output from the input IDs only and do not g
{
"id" : "0",
"type": "fact",
"content" : "I really like cheese pizza"
"content" : "User is a software engineer"
},
{
"id" : "1",
"type": "fact",
"content" : "User is a software engineer"
"content" : "User likes to play cricket"
},
{
"id" : "2",
"type": "fact",
"content" : "User likes to play cricket"
"content" : "Likes racing"
},
{
"id" : "3",
"type": "fact",
"content" : "His usual order is a double cheeseburger"
}
]
- Retrieved entities:
[
{
"id" : "Retrieved_Fact_1",
"type": "fact",
"content" : "Loves chicken pizza"
"content" : "User is a senior software engineer specializing in distributed systems"
},
{
"id" : "Retrieved_Fact_2",
"type": "fact",
"content" : "Loves to play cricket with friends"
}
"content" : "Loves to play cricket with friends on weekends"
},
{
"id" : "Retrieved_Fact_3",
"type": "fact",
"content" : "Loves racing"
},
{
"id" : "Retrieved_Fact_4",
"type": "fact",
"content" : "Always requests his hamburger with grilled onions"
},
]
- New Entities:
{
"entities": [
{
"id" : "0",
"type": "fact",
"content" : "Loves cheese and chicken pizza",
"content" : "User is a senior software engineer specializing in distributed systems",
"event" : "UPDATE",
"old_entity" : "I really like cheese pizza"
"old_entity" : "User is a software engineer"
},
{
"id" : "1",
"type": "fact",
"content" : "User is a software engineer",
"event" : "NONE"
"content" : "Loves to play cricket with friends on weekends",
"event" : "UPDATE",
"old_entity" : "User likes to play cricket"
},
{
"id" : "2",
"type": "fact",
"content" : "Loves to play cricket with friends",
"content" : "Likes cheese pizza",
"event" : "NONE"
},
Comment thread
illeatmyhat marked this conversation as resolved.
{
"id" : "3",
"type": "fact",
"content" : "His usual order is a double cheeseburger with grilled onions",
"event" : "UPDATE",
"old_entity" : "User likes to play cricket"
"old_entity": "His usual order is a double cheeseburger"
}
]
}


3. **Delete**: If the retrieved entities contain information that contradicts the information present in the list of entities, then you have to delete it. Or if the direction is to delete the entity, then you have to delete it.
3. **Delete**: If the retrieved entities contain information that directly contradicts an existing entity — making the old entity false or obsolete (e.g., a preference is reversed, a status is replaced, or the old information is no longer true) — then you have to delete it. Pay special attention to explicit negation phrases such as "no longer", "switched away from", "quit", "stopped using", "replaced" — these always indicate a DELETE. Or if the direction is to delete the entity, then you have to delete it.
Please note to return the IDs in the output from the input IDs only and do not generate any new ID.
- **Example**:
- Old Entities:
Expand All @@ -127,6 +146,11 @@ Please note to return the IDs in the output from the input IDs only and do not g
"id" : "1",
"type": "fact",
"content" : "Loves cheese pizza"
},
{
"id" : "2",
"type": "fact",
"content" : "User uses Jira for project management"
}
]
- Retrieved entities:
Expand All @@ -135,6 +159,11 @@ Please note to return the IDs in the output from the input IDs only and do not g
"id": "Retrieved_Fact_1",
"type": "fact",
"content": "Dislikes cheese pizza"
},
{
"id": "Retrieved_Fact_2",
"type": "fact",
"content": "Team switched from Jira to Linear for project management"
}
]
- New Entities:
Expand All @@ -151,11 +180,23 @@ Please note to return the IDs in the output from the input IDs only and do not g
"type": "fact",
"content" : "Loves cheese pizza",
"event" : "DELETE"
},
{
"id" : "2",
"type": "fact",
"content" : "User uses Jira for project management",
"event" : "DELETE"
},
{
"id" : "Retrieved_Fact_2",
"type": "fact",
"content" : "Team switched from Jira to Linear for project management",
"event" : "ADD"
}
]
}

4. **No Change**: If the retrieved entities contain information that is already present in the list of entities, then you do not need to make any changes.
4. **No Change**: If the retrieved entities contain information that is already present in the list of old entities — including paraphrases, synonyms, or minor rewordings that convey the same meaning — then you do not need to make any changes. Also use NONE for any existing entity that is unrelated to the new entities.
- **Example**:
- Old Entities:
[
Expand All @@ -167,7 +208,17 @@ Please note to return the IDs in the output from the input IDs only and do not g
{
"id" : "1",
"type": "fact",
"content" : "Loves cheese pizza"
"content" : "Likes racing"
},
{
"id" : "2",
"type": "fact",
"content" : "User enjoys running"
},
{
"id" : "3",
"type": "fact",
"content" : "User works from home"
}
]
- Retrieved entities:
Expand All @@ -176,6 +227,21 @@ Please note to return the IDs in the output from the input IDs only and do not g
"id" : "Retrieved_Fact_1",
"type": "fact",
"content" : "Name is John"
},
{
"id" : "Retrieved_Fact_2",
"type": "fact",
"content" : "Loves racing"
},
{
"id" : "Retrieved_Fact_3",
"type": "fact",
"content" : "User likes to run"
},
{
"id" : "Retrieved_Fact_4",
"type": "fact",
"content" : "The user is a remote worker"
}
]
- New Entities:
Expand All @@ -190,8 +256,20 @@ Please note to return the IDs in the output from the input IDs only and do not g
{
"id" : "1",
"type": "fact",
"content" : "Loves cheese pizza",
"content" : "Likes racing",
"event" : "NONE"
},
{
"id" : "2",
"type": "fact",
"content" : "User enjoys running",
"event" : "NONE"
},
{
"id" : "3",
"type": "fact",
"content" : "User works from home",
"event" : "NONE"
}
]
}
}
6 changes: 4 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ dev = [
"pre-commit",
"pytest",
"pytest-cov",
"pytest-retry",
"python-dotenv>=1.2.1",
"python-semantic-release",
"ruff",
Expand All @@ -61,11 +62,12 @@ include = ["kaizen"]
package = true

[tool.pytest.ini_options]
addopts = "--ignore=explorations -m 'not phoenix'"
addopts = "--ignore=explorations -m 'not phoenix and not llm'"
markers = [
"e2e",
"unit",
"phoenix"
"phoenix",
"llm"
]
anyio_mode = "auto"

Expand Down
Loading